Data persistence processing method and device, electronic equipment and storage medium
By acquiring the topology information of the hard disk and central processing unit nodes, creating the target child process, and performing comparison operations on persistent files, the processing latency problem of the server when the dataset is large or when branch functions write data across paths is solved, the efficiency of data persistence processing is improved, and the normal operation of key-value databases is supported.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- INSPUR SUZHOU INTELLIGENT TECH CO LTD
- Filing Date
- 2023-04-26
- Publication Date
- 2026-07-07
AI Technical Summary
The problem arises when the dataset is large or when a branch function process needs to write data across different paths, causing the server to pause processing client data for an excessively long time.
By acquiring the topology information between the hard disk and the central processing unit node, a target child process is created. Based on the topology information, the directly connected hard disk corresponding to the target central processing unit node is used as the persistent hard disk. In response to the target persistent file generated by the backup parent process, the process compares and performs replacement update or mark-delete operations.
It greatly improves the efficiency of server data persistence processing, solves the processing delay problem when the server has a large dataset or when branch function processes write data across paths, and assists the normal operation of key-value databases.
Smart Images

Figure CN116627716B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer server technology, and in particular to a data persistence processing method, a data persistence processing device, an electronic device, and a computer-readable storage medium. Background Technology
[0002] In recent years, enterprises' demand for digital transformation, including artificial intelligence and high-performance computing, has accelerated, leading to a surge in cloud computing usage. To improve service flexibility, major global cloud service providers have launched dual-socket servers. High-performance key-value databases used in dual-socket servers are primarily used for caching and persisting data, supporting various data structures and advanced features. They are often used as solutions for data caching and distributed locking. Since data is stored in memory, which changes rapidly and is prone to loss, high-performance key-value databases provide persistence mechanisms. Each execution of a key-value database persistence command requires calling a branch function to perform the actual persistence work. However, when dealing with large datasets, calling branch functions can be very time-consuming, causing the server to stop processing clients for a period of time. Because the latency of cross-socket disk access is relatively high in dual-socket servers, if the branch function process needs to write data across different sockets, it can significantly increase server downtime. Summary of the Invention
[0003] This invention provides a method, apparatus, electronic device, and computer-readable storage medium for server data persistence, to solve the problem of excessive server downtime when the dataset is large or when branch function processes need to write data across paths.
[0004] This invention discloses a data persistence processing method for a server, characterized in that it is applied to a server, the server including at least a plurality of hard disks and at least one central processing unit node, the server running a backup parent process, and the method comprising:
[0005] Obtain the topology information corresponding to the hard disk and the central processing unit node;
[0006] In response to the replication operation executed by the backup parent process, a target child process corresponding to the replication operation is created, and the target CPU node to which the target child process belongs is obtained. Based on the topology information, the directly connected hard disk corresponding to the target CPU node is used as the persistent hard disk.
[0007] In response to the backup parent process generating a target persistent file, the current persistent file generated by the target child process is obtained, the target persistent file is compared with the current persistent file, and a replacement / update or mark-delete operation is performed on the current persistent file based on the comparison result.
[0008] Optionally, the step of creating a target child process corresponding to the replication operation in response to the replication operation performed by the backup parent process includes:
[0009] If the backup parent process creates a target child process, the target child process returns directly.
[0010] If the backup parent process has not created a target child process, then the branch function is executed to create the target child process corresponding to the replication operation;
[0011] The target subprocess includes at least one of the following: a subprocess for executing a save command, a subprocess for executing a background save command, and a subprocess for appending and rewriting a file.
[0012] Optionally, if the backup parent process has not created a target child process, then executing a branch function to create a target child process corresponding to the replication operation includes:
[0013] When the backup parent process executes a branch function to create a target child process corresponding to the replication operation, the background save instruction blocks the backup parent process. At this time, the backup parent process can only respond to the background save instruction.
[0014] When the backup parent process finishes executing the branch function to create the target child process corresponding to the replication operation, the background save instruction returns start information, where the start information indicates that background saving has started.
[0015] Optionally, the step of using the directly connected hard disk corresponding to the target central processing unit node as a persistent hard disk based on the topology information includes:
[0016] If the central processing unit node where the target child process resides has a directly connected hard disk, then the current persistent file is stored in the directly connected hard disk;
[0017] If the central processing unit node where the target child process resides is not directly connected to a hard disk, the current persistent file will be stored in the default path.
[0018] Optionally, comparing the target persistent file with the current persistent file and performing a replacement / update or mark-delete operation on the current persistent file based on the comparison result includes:
[0019] If the target persistent file and the current persistent file are on the same hard drive, then the target persistent file directly replaces the current persistent file, and the storage location information of the target persistent file is updated.
[0020] If the target persistent file and the current persistent file are not on the same hard drive, the current persistent file is marked as an old file, and the old file is deleted after updating the storage location information of the target persistent file.
[0021] Optionally, before obtaining the current persistent file generated by the target child process in response to the backup parent process generating the target persistent file, the method further includes:
[0022] When the backup parent process modifies the server data a preset number of times within a preset time period, the backup parent process generates the target persistent file in the form of a snapshot.
[0023] This invention also discloses a data persistence processing apparatus, comprising:
[0024] The information acquisition module is used to acquire the topology information corresponding to the hard disk and the central processing unit node;
[0025] The replication response module is used to respond to the replication operation executed by the backup parent process, create a target child process corresponding to the replication operation, obtain the target CPU node to which the target child process belongs, and use the directly connected hard disk corresponding to the target CPU node as the persistent hard disk according to the topology information.
[0026] The file comparison module is used to respond to the backup parent process generating a target persistent file, obtain the current persistent file generated by the target child process, compare the target persistent file with the current persistent file, and perform a replacement / update or mark-delete operation on the current persistent file based on the comparison result.
[0027] Optionally, the replica response module is specifically used for:
[0028] If the backup parent process creates a target child process, the target child process returns directly.
[0029] If the backup parent process has not created a target child process, then the branch function is executed to create the target child process corresponding to the replication operation;
[0030] The target subprocess includes at least one of the following: a subprocess for executing a save command, a subprocess for executing a background save command, and a subprocess for appending and rewriting a file.
[0031] Optionally, the replica response module is specifically used for:
[0032] When the backup parent process executes a branch function to create a target child process corresponding to the replication operation, the background save instruction blocks the backup parent process. At this time, the backup parent process can only respond to the background save instruction.
[0033] When the backup parent process finishes executing the branch function to create the target child process corresponding to the replication operation, the background save instruction returns start information, where the start information indicates that background saving has started.
[0034] Optionally, the replica response module is specifically used for:
[0035] If the central processing unit node where the target child process resides has a directly connected hard disk, then the current persistent file is stored in the directly connected hard disk;
[0036] If the central processing unit node where the target child process resides is not directly connected to a hard disk, the current persistent file will be stored in the default path.
[0037] Optionally, the file comparison module is specifically used for:
[0038] If the target persistent file and the current persistent file are on the same hard drive, then the target persistent file directly replaces the current persistent file, and the storage location information of the target persistent file is updated.
[0039] If the target persistent file and the current persistent file are not on the same hard drive, the current persistent file is marked as an old file, and the old file is deleted after updating the storage location information of the target persistent file.
[0040] Optionally, the file comparison module is specifically used for:
[0041] When the backup parent process modifies the server data a preset number of times within a preset time period, the backup parent process generates the target persistent file in the form of a snapshot.
[0042] Optionally, the file comparison module includes:
[0043] The replacement and update module is used to directly replace the current persistent file with the target persistent file and update the storage location information of the target persistent file when the target persistent file and the current persistent file are on the same hard disk.
[0044] The marking and deletion module is used to mark the current persistent file as an old file when the target persistent file and the current persistent file are not on the same hard drive, and to delete the old file after updating the storage location information of the target persistent file.
[0045] This invention also discloses an electronic device, characterized in that it includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus;
[0046] The memory is used to store computer programs;
[0047] The processor, when executing a program stored in the memory, implements the method described in the embodiments of the present invention.
[0048] This invention also discloses a computer-readable storage medium storing instructions that, when executed by one or more processors, cause the processors to perform the methods described in this invention.
[0049] The embodiments of the present invention have the following advantages:
[0050] In this embodiment of the invention, for data persistence, the topology information corresponding to the hard disk and the central processing unit (CPU) node can be obtained. Then, in response to the replication operation executed by the backup parent process, a target child process corresponding to the replication operation is created, and the target CPU node to which the target child process belongs is obtained. According to the topology information, the directly connected hard disk corresponding to the target CPU node is used as the persistent hard disk. Finally, in response to the backup parent process generating the target persistent file, the current persistent file generated by the target child process is obtained, the target persistent file is compared with the current persistent file, and a replacement / update or mark-delete operation is performed on the current persistent file according to the comparison result. This solves the problem of excessive server downtime when the dataset is large or the branch function process needs to write data across paths, greatly improving the efficiency of server data persistence processing, thereby better assisting the operation of key-value databases. Attached Figure Description
[0051] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0052] Figure 1This is a flowchart of the steps of a data persistence processing method provided in an embodiment of the present invention;
[0053] Figure 2 This is a structural block diagram of a data persistence processing device provided in an embodiment of the present invention;
[0054] Figure 3 This is a structural block diagram of the file comparison module 203 in a data persistence processing device provided in an embodiment of the present invention. Detailed Implementation
[0055] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0056] In recent years, enterprises' demand for digital transformation, including artificial intelligence and high-performance computing, has accelerated, leading to a surge in cloud computing usage. To improve service flexibility, major global cloud service providers have successively launched dual-socket servers. Dual-socket servers utilize a high-performance key-value database, with data stored in memory. Since data in memory changes rapidly and is prone to loss, key-value databases provide a persistence mechanism. Each time a data persistence command is executed, a branch function is called to perform the actual persistence work. However, when dealing with large datasets, calling branch functions can be very time-consuming, causing the server to stop processing clients for a period of time.
[0057] To address this issue, the present invention provides a data persistence processing method, apparatus, electronic device, and storage medium, applied in the field of computer server technology. Specifically, it involves acquiring the topology information corresponding to the hard disk and the central processing unit (CPU) node; then, in response to the replication operation executed by the backup parent process, creating a target child process corresponding to the replication operation, and acquiring the target CPU node to which the target child process belongs. Based on the topology information, the directly connected hard disk corresponding to the target CPU node is used as the persistent hard disk; finally, in response to the backup parent process generating a target persistent file, acquiring the current persistent file generated by the target child process, comparing the target persistent file with the current persistent file, and performing a replacement / update or mark-delete operation on the current persistent file based on the comparison result. This solves the problem of excessively long server downtime when processing client data when the dataset is large or when branch function processes need to write data across paths, greatly improving the efficiency of server data persistence processing and thus better assisting the operation of key-value databases.
[0058] Reference Figure 1 This diagram illustrates a flowchart of a data persistence processing method provided in an embodiment of the present invention. The method is applied to a server, which includes at least several hard disks and at least one central processing unit node. The server runs a backup parent process, and the method specifically includes the following steps:
[0059] Step 101: Obtain the topology information corresponding to the hard disk and the central processing unit node;
[0060] In this embodiment of the invention, a server may include several hard disks and at least one central processing unit (CPU) node. The hard disks can be used for data storage, and the CPU node can be a CPU node responsible for data processing. Simultaneously, a corresponding backup parent process can run on the server, enabling persistent data processing on the server. Regarding the hard disks and CPU nodes, a CPU node can communicate with at least one hard disk. Data processed by the CPU node can be stored on the directly connected hard disk, thus achieving data storage. Therefore, the topology information can represent the connection status between different hard disks and different CPU nodes within the server, as well as the distribution information of each hard disk and CPU node within the server.
[0061] Step 102: In response to the replication operation executed by the backup parent process, create a target child process corresponding to the replication operation, obtain the target CPU node to which the target child process belongs, and use the directly connected hard disk corresponding to the target CPU node as the persistent hard disk according to the topology information.
[0062] Specifically, if the backup parent process creates a target child process, the target child process returns directly;
[0063] Specifically, if the backup parent process has not created a target child process, then the branch function is executed to create the target child process corresponding to the replication operation;
[0064] Specifically, the target subprocess includes at least one of the following: a subprocess for executing a save command, a subprocess for executing a background save command, and a subprocess for appending and rewriting a file.
[0065] In one specific implementation, the branch function is used to create a child process. The created child process only shares and replicates the memory data at the moment of its creation. Subsequent modifications to the data by the parent process are invisible to the child process, and vice versa. For example, if process A creates a child process B, then process A is called the parent process. At this point, the parent and child processes point to the same memory space, so their data is consistent. However, if A modifies a piece of data in memory, this modification is hidden from B. Whether A adds or deletes data, it remains hidden from B. Furthermore, when child process B encounters an error, it has no effect on parent process A, which continues to execute normally. However, when parent process A encounters an error, the child process also encounters an error.
[0066] In one specific embodiment, the dual-processor server supports five data types: string, hash, list, unordered set, and sorted set (zset). Its data structures include: integer, string, doubly linked list, compressed list, dictionary, integer set, and skip list. Among them, the doubly linked list provides efficient node rearrangement capabilities and sequential node access methods; the compressed list is used as the underlying implementation of the list key when a list key contains only a small number of list items, and each list item is either a small integer or a short string; the integer set is used as the underlying implementation of the set key when a set contains only integer value elements and the number of elements in the set is small.
[0067] In one specific embodiment, the dual-path server protocol supports the following data types: simple characters (first byte: "+"), such as "+OK\r\n"; errors (first byte: "-"), such as "-error msg\r\n"; numbers (first byte: ":"), such as ":123\r\n"; batch characters (first byte: "$"), such as "&hello\r\nWhoa re you\r\n"; and arrays (first byte: "*"), such as "*0\r\n" and "*-1\r\n".
[0068] In one specific embodiment, when executing a background save command, the backup parent process performs a snapshot operation in the background, while simultaneously responding to client requests. Specifically, the backup parent process executes a branch function to create a child process, which is responsible for the data persistence process. The child process automatically terminates upon completion, with blocking only occurring during the branch function phase.
[0069] In one specific implementation, the backup parent process creates a child process via a branch function. After the child process is created, the parent and child processes share the code segment but not the process's data space, although the child process receives a copy of the parent process's data space. At the operating system level, copy-on-write is used. This means that before either the parent or child process modifies the data space, they actually share the data space. However, when either the parent or child process modifies the data space, the operating system creates a copy of the modified portion. Although the child process does not copy the parent process's data space when executing a branch function, it does copy the memory page table (which is equivalent to an index or directory in memory). The larger the parent process's data space, the larger the memory page table, and the more time-consuming the copying process will be when executing a branch function.
[0070] In one specific embodiment, the code prototype for the branch function to create the target child process is as follows:
[0071] The function `pid_t fork(void)`, where `pid_t` is of type `int`, indicates that the process has been overloaded.
[0072] `pid_t getpid()` retrieves the PID value of the current process.
[0073] The pid_t getppid() function retrieves the PID value of the parent process of the current process.
[0074] Specifically, when the backup parent process executes a branch function to create a target child process corresponding to the replication operation, the background save instruction blocks the backup parent process. At this time, the backup parent process can only respond to the background save instruction.
[0075] Specifically, when the backup parent process finishes executing the branch function to create the target child process corresponding to the replication operation, the background save instruction returns start information, where the start information indicates that background saving has started.
[0076] Specifically, if the central processing unit node where the target subprocess resides has a directly connected hard disk, then the current persistent file is stored in the directly connected hard disk;
[0077] Specifically, if the central processing unit node where the target child process is located is not directly connected to the hard disk, the current persistent file is stored in the default path.
[0078] Step 103: In response to the backup parent process generating the target persistent file, obtain the current persistent file generated by the target child process, compare the target persistent file with the current persistent file, and perform a replacement / update or mark-delete operation on the current persistent file based on the comparison result.
[0079] Specifically, if the target persistent file and the current persistent file are on the same hard drive, the target persistent file is directly used to replace the current persistent file, and the storage location information of the target persistent file is updated.
[0080] Specifically, if the target persistent file and the current persistent file are not on the same hard drive, the current persistent file is marked as an old file, and the old file is deleted after updating the storage location information of the target persistent file.
[0081] Specifically, in response to the backup parent process generating the target persistent file and before obtaining the current persistent file generated by the target child process, the method further includes: when the backup parent process modifies the server data a preset number of times within a preset time, in response to the backup parent process generating the target persistent file in the form of a snapshot.
[0082] In one specific embodiment, when the backup parent process modifies the data on the server at least once within 900 seconds, a snapshot instruction is executed to generate the target persistent file;
[0083] In one specific embodiment, when the backup parent process modifies the data on the server at least 10 times within 300 seconds, a snapshot instruction is executed to generate the target persistent file;
[0084] In one specific embodiment, when the backup parent process makes at least 10,000 modifications to the data on the server within 60 seconds, a snapshot instruction is executed to generate the target persistent file.
[0085] In one specific embodiment, the code for the snapshot instruction is as follows:
[0086] `save 900 1` (means that if at least one data key-value pair changes within 900 seconds, the target persistent file will be generated);
[0087] `save 300 1` (means that if at least 10 data key-value pairs change within 300 seconds, the target persistent file will be generated);
[0088] `save 60 10000` (means that if at least 10,000 data key-value pairs change within 60 seconds, the target persistent file will be generated).
[0089] In one specific embodiment, the snapshot instruction refers to backing up all the memory data of the backup parent process in binary serialization. When performing snapshot persistence, a child process is started to be responsible for snapshot persistence. The child process will have the memory data of the parent process. Modifications made by the parent process to the memory will not be reflected in the child process. Therefore, the data modified during snapshot persistence will not be saved.
[0090] In this embodiment of the invention, for data persistence processing, the topology information corresponding to the hard disk and the central processing unit (CPU) node can be obtained; then, in response to the replication operation executed by the backup parent process, a target child process corresponding to the replication operation is created, and the target CPU node to which the target child process belongs is obtained. According to the topology information, the directly connected hard disk corresponding to the target CPU node is used as the persistent hard disk; finally, in response to the backup parent process generating the target persistent file, the current persistent file generated by the target child process is obtained, the target persistent file is compared with the current persistent file, and a replacement / update or mark-delete operation is performed on the current persistent file according to the comparison result. This solves the problem of excessively long server downtime when the dataset is large or branch function processes need to write data across paths, greatly improving the efficiency of server data persistence processing, thereby better assisting the operation of key-value databases.
[0091] It should be noted that, for the sake of simplicity, the method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments of the present invention are not limited to the described order of actions, because according to the embodiments of the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions involved are not necessarily essential to the embodiments of the present invention.
[0092] Reference Figure 2 The diagram shows a structural block diagram of a data persistence processing device provided in an embodiment of the present invention, which specifically includes the following modules:
[0093] Information acquisition module 201 is used to acquire the topology information corresponding to the hard disk and the central processing unit node;
[0094] The replication response module 202 is used to respond to the replication operation executed by the backup parent process, create a target child process corresponding to the replication operation, obtain the target CPU node to which the target child process belongs, and use the directly connected hard disk corresponding to the target CPU node as the persistent hard disk according to the topology information.
[0095] The file comparison module 203 is used to respond to the backup parent process generating a target persistent file, obtain the current persistent file generated by the target child process, compare the target persistent file with the current persistent file, and perform a replacement / update or mark-delete operation on the current persistent file according to the comparison result.
[0096] In one specific embodiment, the information acquisition module 201 is specifically used for:
[0097] This invention obtains the distribution and connection status of all hard drives and central processing units in a computer. In this embodiment, it is applied to a server, wherein the server includes at least a number of hard drives and at least one central processing unit node, and the server runs a backup parent process.
[0098] In one specific embodiment, the replication response module 202 is specifically used for:
[0099] If the backup parent process has created a target child process, then the target child process will be returned directly.
[0100] If the backup parent process has not created a target child process, then the branch function is executed to create the target child process corresponding to the replication operation;
[0101] The target subprocess includes at least one of the following: a subprocess for executing a save command, a subprocess for executing a background save command, and a subprocess for appending and rewriting a file.
[0102] In one specific embodiment, the replication response module 202 is specifically used for:
[0103] When the backup parent process executes a branch function to create the target child process corresponding to the replication operation, the background save instruction blocks the backup parent process. At this time, the backup parent process can only respond to the background save instruction.
[0104] When the backup parent process finishes executing the branch function to create the target child process corresponding to the replication operation, the background save instruction returns start information, which indicates that background saving has started.
[0105] In one specific embodiment, the replication response module 202 is specifically used for:
[0106] If the CPU node where the target child process resides has a directly connected hard disk, then the current persistent file is stored on the directly connected hard disk;
[0107] If the CPU node where the target child process resides is not directly connected to the hard disk, the current persistent file will be stored in the default path.
[0108] In one specific embodiment, the file comparison module 203 is specifically used for:
[0109] If the target persistent file and the current persistent file are on the same hard drive, then the current persistent file is directly replaced with the target persistent file, and the storage location information of the target persistent file is updated.
[0110] If the target persistent file and the current persistent file are not on the same hard drive, the current persistent file is marked as the old file, and the old file is deleted after updating the storage location information of the target persistent file.
[0111] In one specific embodiment, the file comparison module 203 is specifically used for:
[0112] When the backup parent process modifies the server data a preset number of times within a preset time period, the target persistent file is generated in the form of a snapshot in response to the backup parent process.
[0113] Reference Figure 3 The diagram shows a structural block diagram of a file comparison module 203 in a data persistence processing device provided in an embodiment of the present invention, which specifically includes the following modules:
[0114] The replacement update module 203-1 is specifically used to directly replace the current persistent file with the target persistent file and update the storage location information of the target persistent file when the target persistent file and the current persistent file are on the same hard disk.
[0115] The marking and deletion module 203-2 is specifically used to mark the current persistent file as an old file and delete the old file after updating the storage location information of the target persistent file when the target persistent file and the current persistent file are not on the same hard disk.
[0116] As the device embodiment is basically similar to the method embodiment, the description is relatively simple, and relevant parts can be found in the description of the method embodiment.
[0117] In addition, this invention also provides an electronic device, including: a processor, a memory, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, it implements the various processes of the above-described key-value database persistence method embodiments and achieves the same technical effect. To avoid repetition, it will not be described again here.
[0118] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.
[0119] This invention also provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it implements the various processes of the above-described data persistence processing method embodiments and achieves the same technical effect. To avoid repetition, it will not be described again here. The computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, etc.
[0120] As the device embodiment is basically similar to the method embodiment, the description is relatively simple, and relevant parts can be found in the description of the method embodiment.
[0121] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.
[0122] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, apparatus, or computer program products. Therefore, embodiments of the present invention can take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware aspects. Furthermore, embodiments of the present invention can take the form of computer program products 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.
[0123] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will 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 terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0124] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing terminal 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 a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0125] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal equipment, causing a series of operational steps to be performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable terminal 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.
[0126] Although preferred embodiments of the present invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments of the present invention.
[0127] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes said element.
[0128] The technical solution provided by the present invention has been described in detail above. Specific examples have been used to illustrate the principle and implementation of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core idea of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation and application scope based on the idea of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A data persistence processing method, characterized in that, Applied to a server, the server comprising at least a plurality of hard disks and at least one central processing unit node, the server running a backup parent process, the method comprising: Obtain the topology information corresponding to the hard disk and the central processing unit node; In response to the replication operation executed by the backup parent process, a target child process corresponding to the replication operation is created, and the target CPU node to which the target child process belongs is obtained. Based on the topology information, the directly connected hard disk corresponding to the target CPU node is used as the persistent hard disk. In response to the backup parent process generating a target persistent file, the current persistent file generated by the target child process is obtained, the target persistent file is compared with the current persistent file, and a replacement / update or mark-delete operation is performed on the current persistent file based on the comparison result; The step of comparing the target persistent file with the current persistent file, and performing a replacement / update or mark-delete operation on the current persistent file based on the comparison result, includes: If the target persistent file and the current persistent file are on the same hard drive, then the target persistent file directly replaces the current persistent file, and the storage location information of the target persistent file is updated. If the target persistent file and the current persistent file are not on the same hard drive, then the current persistent file is marked as an old file, and the old file is deleted after updating the storage location information of the target persistent file; The method further includes, prior to obtaining the current persistent file generated by the target child process in response to the backup parent process generating the target persistent file: When the backup parent process modifies the server data a preset number of times within a preset time period, the backup parent process generates the target persistent file in the form of a snapshot.
2. The method according to claim 1, characterized in that, The step of creating a target child process corresponding to the replication operation in response to the replication operation executed by the backup parent process includes: If the backup parent process creates a target child process, the target child process returns directly. If the backup parent process has not created a target child process, then the branch function is executed to create the target child process corresponding to the replication operation; The target subprocess includes at least one of the following: a subprocess for executing a save command, a subprocess for executing a background save command, and a subprocess for appending and rewriting a file.
3. The method according to claim 2, characterized in that, If the backup parent process has not created a target child process, then executing a branch function to create a target child process corresponding to the replication operation includes: When the backup parent process executes a branch function to create a target child process corresponding to the replication operation, the background save instruction blocks the backup parent process. At this time, the backup parent process can only respond to the background save instruction. When the backup parent process finishes executing the branch function to create the target child process corresponding to the replication operation, the background save instruction returns start information, where the start information indicates that background saving has started.
4. The method according to claim 1, characterized in that, The step of using the directly connected hard disk corresponding to the target central processing unit node as a persistent hard disk according to the topology information includes: If the central processing unit node where the target child process resides has a directly connected hard disk, then the current persistent file is stored in the directly connected hard disk; If the central processing unit node where the target child process resides is not directly connected to a hard disk, the current persistent file will be stored in the default path.
5. A data persistence processing device, characterized in that, include: The information acquisition module is used to acquire the corresponding topology information between the hard disk and the central processing unit node; The replication response module is used to respond to the replication operation executed by the backup parent process, create a target child process corresponding to the replication operation, obtain the target CPU node to which the target child process belongs, and use the directly connected hard disk corresponding to the target CPU node as the persistent hard disk according to the topology information. The file comparison module is used to respond to the backup parent process generating a target persistent file, obtain the current persistent file generated by the target child process, compare the target persistent file with the current persistent file, and perform a replacement / update or mark-delete operation on the current persistent file according to the comparison result; The file comparison module includes: The replacement and update module is used to directly replace the current persistent file with the target persistent file and update the storage location information of the target persistent file when the target persistent file and the current persistent file are on the same hard disk. The marking and deletion module is used to mark the current persistent file as an old file when the target persistent file and the current persistent file are not on the same hard drive, and to delete the old file after updating the storage location information of the target persistent file; Specifically, the file comparison module is used for: When the backup parent process modifies the server data a preset number of times within a preset time period, the target persistent file is generated in the form of a snapshot in response to the backup parent process.
6. An electronic device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; The memory is used to store computer programs; When the processor executes a program stored in the memory, it implements the method as described in any one of claims 1 to 4.
7. A computer-readable storage medium having instructions stored thereon that, when executed by one or more processors, cause the processors to perform the method as described in any one of claims 1 to 4.