Method and device for flushing write-ahead log
By obtaining and utilizing the memory information of the preset storage structure in the database server, determining and writing related write-ahead logs, the problem of not being able to effectively release the memory of the database server in the prior art is solved, and the memory release efficiency and stability are improved.
Patent Information
- Application Number
- CN202210051320.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-17
- Publication Date
- 2025-05-23
- Estimated Expiration
- 2042-01-17
AI Technical Summary
The existing technology cannot effectively release the database server memory, resulting in the inability to alleviate the memory pressure.
By obtaining the memory usage information of the preset storage structure in the database server, a write-pre-log containing the sum of the memory information of the preset storage structure is greater than or equal to the preset memory threshold is determined, and a write-ready process is performed.
The database server WAL flash write balance is realized, solving the problem of not being able to release effective Memstore memory, and improving memory release efficiency and the stability of the database server.
Smart Images

Figure CN114385368B_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of computer technology, and specifically relates to a method and device for flashing a pre-written log. Background Art
[0002] In the related art, there are multiple flushing strategies in the process of refreshing the write-ahead log (WAL) buffer of the log structured merge (LSM) type database server. For example, when the number of WALs is greater than the relevant threshold, the flushing condition is triggered, and the WAL file with the longest generation time will be selected for flushing. However, this method cannot release the maximum database server memory and cannot achieve the purpose of relieving the pressure on the database server memory. Summary of the invention
[0003] The purpose of the embodiments of the present application is to provide a method and device for flushing a write-ahead log, which can solve the problem in the related art that the maximum database server memory cannot be released.
[0004] In a first aspect, an embodiment of the present application provides a method for flashing a write-ahead log, the method comprising:
[0005] Obtaining memory usage information of a preset storage structure in a database server;
[0006] When the number of write-ahead logs generated in the database server is greater than or equal to a preset number threshold, determining a first write-ahead log in the write-ahead log according to the memory usage information of the preset storage structure;
[0007] The first write-ahead log is flushed.
[0008] In a second aspect, an embodiment of the present application provides a flashing device for a pre-written log, the flashing device comprising:
[0009] An acquisition module is used to acquire memory usage information of a preset storage structure in a database server;
[0010] A first determining module, configured to determine a first write-ahead log in the write-ahead log according to the used memory information of a preset storage structure when the number of write-ahead logs generated in the database server is greater than or equal to a preset number threshold;
[0011] The flash module is used to flash the first write-ahead log.
[0012] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor and a memory, wherein the memory stores programs or instructions that can be run on the processor, and when the programs or instructions are executed by the processor, the steps of the method of the first aspect are implemented.
[0013] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method of the first aspect are implemented.
[0014] In a fifth aspect, an embodiment of the present application provides a chip, the chip including a processor and a communication interface, the communication interface and the processor are coupled, and the processor is used to run programs or instructions to implement the method of the first aspect.
[0015] In a sixth aspect, an embodiment of the present application provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the method of the first aspect.
[0016] In an embodiment of the present application, if the number of WALs of a database server is greater than or equal to a preset number threshold, the flushing of the write-ahead log will be triggered. Specifically, the memory usage information of the preset storage structure in the database server is counted, and when it is determined that the number of WALs of the database server is greater than or equal to the preset number threshold, the first write-ahead log is determined based on the memory usage information of the preset storage structure, wherein the first write-ahead log is a write-ahead log in which the sum of the memory usage information of the preset storage structure contained is greater than or equal to the preset memory threshold. Thus, the database partition corresponding to the first write-ahead log is found, and then these database partitions are flushed. In an embodiment of the present application, a method for flushing balance of WALs of a database server is implemented by combining the memory usage of a preset storage structure, which solves the problem of the inability to release effective Memstore memory in the related art, improves the memory release efficiency in the database server, and improves the stability of the database server. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 It is a flowchart of a method for flashing a write-ahead log according to an embodiment of the present application;
[0018] Figure 2 is a schematic block diagram of a flashing device for a pre-write log according to an embodiment of the present application;
[0019] Figure 3 It is one of the schematic block diagrams of the electronic device according to the embodiment of the present application;
[0020] Figure 4 This is the second schematic block diagram of the electronic device according to the embodiment of the present application. DETAILED DESCRIPTION
[0021] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.
[0022] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0023] In conjunction with the accompanying drawings, the method for flushing a write-ahead log and the device for flushing a write-ahead log provided in the embodiments of the present application are described in detail through specific embodiments and their application scenarios.
[0024] The present application embodiment provides a method for flashing a pre-written log, such as Figure 1 As shown, the flash writing method includes:
[0025] Step 102, obtaining memory usage information of a preset storage structure in a database server;
[0026] Step 104, when the number of write-ahead logs generated in the database server is greater than or equal to a preset number threshold, determining a first write-ahead log in the write-ahead log according to the used memory information of the preset storage structure;
[0027] Step 106: flush the first write-ahead log.
[0028] In this embodiment, WAL can be used to solve the problem of operation recovery after downtime. When data arrives at the database partition (Region) of the database server, it is first written to WAL, and then written to the preset storage structure in the memory. If the number of WALs increases, it means that there is more and more data in the preset storage structure that is not persisted to the disk. When the database server hangs up, the recovery time will become longer and longer, so it is necessary to perform a flush operation when the WAL reaches a certain number.
[0029] Therefore, in the embodiment of the present application, if the number of WALs of a database server is greater than or equal to a preset number threshold, the flushing of the write-ahead log will be triggered. Specifically, the memory usage information of the preset storage structure in the database server is counted, and when it is determined that the number of WALs of the database server is greater than or equal to the preset number threshold, the first write-ahead log is determined based on the memory usage information of the preset storage structure, wherein the first write-ahead log is a write-ahead log in which the sum of the memory usage information of the preset storage structure contained is greater than or equal to the preset memory threshold. Thus, the database partitions corresponding to the first write-ahead log are found, and then these database partitions are flushed.
[0030] It should be noted that the preset storage structure is a key-value storage structure (Memstore), and the database server is a server for processing database data (RegionServer).
[0031] The embodiment of the present application implements a method for balancing WAL flushing of a database server by using memory in combination with a preset storage structure, thereby solving the problem in the related art that effective Memstore memory cannot be released, improving the efficiency of releasing memory in the database server, and improving the stability of the database server.
[0032] Further, in one embodiment of the present application, determining a first write-ahead log in a write-ahead log according to the used memory information of a preset storage structure includes: determining N target storage structures according to the used memory information of the preset storage structure, where N is a positive integer; determining second write-ahead logs corresponding to the N target storage structures respectively; and determining the first write-ahead log in the second write-ahead log according to the sum of the used memory information of the preset storage structures included in the second write-ahead log.
[0033] In this embodiment, when the number of write-ahead logs generated in the database server is greater than or equal to the preset number threshold, the preset storage structures on the database server are first sorted in descending order according to the memory usage. Then, according to the correspondence table between the pre-stored write-ahead logs and the preset storage structures, the file name of the write-ahead log (i.e., the second write-ahead log) corresponding to the preset storage structure (i.e., the target storage structure) that occupies a large amount of memory can be clearly known. Finally, these second write-ahead logs are sorted in descending order according to the sum of the memory usage information of the preset storage structures included therein, and the first one or more write-ahead logs (i.e., the first write-ahead logs) are obtained for flushing processing.
[0034] Exemplarily, on a database server, when the number of WALs is greater than or equal to a preset number threshold, the preset storage structures on the database server are sorted in descending order according to the memory usage, and the preset storage structure IDs ranked in the top M are selected. The correspondence table between the pre-stored WAL file names and the preset storage structure IDs contained therein is traversed, and a set of WAL file names related to the top M preset storage structure IDs is correspondingly found. Then, from the obtained set of WAL file names, the sum of the memory usage of all the preset storage structure IDs contained in the WAL is sorted in descending order, and the WAL with the largest sum of memory usage is selected.
[0035] For example, the preset storage structure includes a, b, c, d, e, f, g, and the WAL includes A, B, C, and D. The correspondence between WAL and the preset storage structure includes: A corresponds to a, b, c, B corresponds to d, g, C corresponds to f, and D corresponds to e. The preset storage structures are a, b, c, d, e, f, and g in order of memory usage from large to small. The preset storage structures ranked in the top 5 are selected, namely a, b, c, d, and e. According to the correspondence, the set of WAL file names found is A, B, and D. The sum of the memory used by a, b, and c is greater than the sum of the memory used by d and g, and the sum of the memory used by d and g is greater than the memory used by e. The preset storage structures are sorted in descending order according to the sum of the memory used, such as A, B, and D, so that A with the largest sum of memory used is flashed.
[0036] The embodiment of the present application more effectively improves the memory utilization of the database server by considering the memory usage of the preset storage structure, makes the memory usage of the database server more balanced, avoids Java garbage collection (Garbage Collection, GC) of the database server at the system level, thereby achieving the effect of improving the memory resource utilization of the database server, and effectively reduces the database server downtime caused by GC, thereby improving the stability and reliability of the database server.
[0037] Furthermore, in one embodiment of the present application, the flashing method further includes: when the sum of used memory of the preset storage structure included in the second write-ahead log is equal, determining the first write-ahead log in the second write-ahead log according to the log generation time of the second write-ahead log.
[0038] In this embodiment, for WALs with the same total memory usage, the WAL with a longer log generation time, that is, the earliest generated WAL, is determined as the first write-ahead log. By comprehensively considering the memory usage of the preset storage structure and the WAL generation time, the memory utilization of the database server is more effectively improved.
[0039] Further, in an embodiment of the present application, obtaining the used memory information of a preset storage structure in a database server includes: obtaining the used memory information of the preset storage structure in each database partition of the database server.
[0040] In this embodiment, by counting the used memory situation of each preset storage structure in each database partition of the database server, it is possible to effectively analyze which more effective preset storage structures should be released during this WAL archiving, so as to be able to analyze the overall memory situation of the database server more comprehensively and reliably, providing a basis for implementing a more efficient preset storage structure writing mechanism and database server memory release mechanism.
[0041] It should be noted that after the statistics, a HashMap in the form of database partition name_preset storage structure ID - used memory size value can be generated and sorted according to the used memory size.
[0042] Further, in an embodiment of the present application, after obtaining the used memory information of the preset storage structure in the database server, it further includes: determining the preset storage structures included in the write-ahead log.
[0043] In this embodiment, for each generated unarchived WAL, determine the preset storage structures it contains, and establish a one-to-many mapping relationship between the WAL and the preset storage structures it contains, generating a correspondence table in the form of WAL name - {included preset storage structure ID}.
[0044] The embodiments of the present application can accurately determine the write-ahead logs that need to be written according to the above correspondence relationship, thereby improving the memory release efficiency in the database server and improving the stability of the database server.
[0045] The write-ahead log writing method provided by the embodiments of the present application may be executed by a write-ahead log writing device. In the embodiments of the present application, taking the write-ahead log writing device executing the write-ahead log writing method as an example, the write-ahead log writing device provided by the embodiments of the present application is described.
[0046] The embodiments of the present application provide a write-ahead log writing device, as Figure 2 shown, the write-ahead log writing device 200 includes:
[0047] An obtaining module 202, configured to obtain the used memory information of the preset storage structure in the database server;
[0048] A first determining module 204, configured to determine a first write-ahead log in the write-ahead logs according to the used memory information of the preset storage structure when the number of write-ahead logs generated in the database server is greater than or equal to a preset number threshold;
[0049] The flush module 206 is used to flush the first write-ahead log.
[0050] In this embodiment, if the number of WALs of a database server is greater than or equal to a preset number threshold, the flushing of the write-ahead log will be triggered. Specifically, the memory usage information of the preset storage structure in the database server is counted, and when it is determined that the number of WALs of the database server is greater than or equal to the preset number threshold, the first write-ahead log is determined based on the memory usage information of the preset storage structure, wherein the first write-ahead log is a write-ahead log in which the sum of the memory usage information of the preset storage structure contained is greater than or equal to the preset memory threshold. Thus, the database partition corresponding to the first write-ahead log is found, and then these database partitions are flushed. In the embodiment of the present application, a method for balancing the flushing of WALs of a database server is implemented by combining the memory usage of a preset storage structure, which solves the problem of being unable to release effective Memstore memory in the related art, improves the memory release efficiency in the database server, and improves the stability of the database server.
[0051] Further, in one embodiment of the present application, the first determination module 204 is specifically used to: determine N target storage structures according to the used memory information of the preset storage structure, where N is a positive integer; determine the second write-ahead logs corresponding to the N target storage structures respectively; and determine the first write-ahead log in the second write-ahead log according to the sum of the used memory information of the preset storage structure included in the second write-ahead log.
[0052] Further, in one embodiment of the present application, the first determination module 204 is also used to: when the sum of the used memory information of the preset storage structure included in the second write-ahead log is equal, determine the first write-ahead log in the second write-ahead log according to the log generation time of the second write-ahead log.
[0053] Furthermore, in one embodiment of the present application, the acquisition module 202 is specifically configured to acquire memory usage information of a preset storage structure of each database partition of the database server.
[0054] Furthermore, in one embodiment of the present application, the write-ahead log flashing device 200 further includes: a second determination module, configured to determine a preset storage structure included in the write-ahead log.
[0055] The flashing device 200 of the pre-written log in the embodiment of the present application can be an electronic device, or a component in an electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal, or it can be other devices other than a terminal. Exemplarily, the electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, a car electronic device, a mobile Internet device (Mobile Internet Device, MID), an augmented reality (augmented reality, AR) / virtual reality (virtual reality, VR) device, a robot, a wearable device, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook or a personal digital assistant (personal digital assistant, PDA), etc., and can also be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (personal computer, PC), a television (television, TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.
[0056] The pre-write log flashing device 200 in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.
[0057] The flashing device 200 of the pre-write log provided in the embodiment of the present application can achieve Figure 1 To avoid repetition, the various processes implemented by the embodiment of the method for flashing a write-ahead log are not described here.
[0058] Alternatively, if Figure 3 As shown, an embodiment of the present application further provides an electronic device 300, including a processor 302 and a memory 304, wherein the memory 304 stores programs or instructions that can be executed on the processor 302, and when the program or instructions are executed by the processor 302, the various steps of the above-mentioned pre-write log flashing method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, they are not described here.
[0059] It should be noted that the electronic devices in the embodiments of the present application include the above-mentioned mobile electronic devices and non-mobile electronic devices.
[0060] Figure 4 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of the present application.
[0061] The electronic device 400 includes but is not limited to components such as a radio frequency unit 402 , a network module 404 , an audio output unit 406 , an input unit 408 , a sensor 410 , a display unit 412 , a user input unit 414 , an interface unit 416 , a memory 418 , and a processor 420 .
[0062] Those skilled in the art will appreciate that the electronic device 400 may also include a power source (such as a battery) for supplying power to each component, and the power source may be logically connected to the processor 420 through a power management system, thereby implementing functions such as managing charging, discharging, and power consumption management through the power management system. Figure 4 The electronic device structure shown in the figure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently, which will not be described in detail here.
[0063] Among them, processor 420 is used to obtain the used memory information of the preset storage structure in the database server, and when the number of pre-write logs generated in the database server is greater than or equal to the preset number threshold, determine the first pre-write log in the pre-write log according to the used memory information of the preset storage structure, and flush the first pre-write log.
[0064] In this embodiment, if the number of WALs of a database server is greater than or equal to a preset number threshold, the flushing of the write-ahead log will be triggered. Specifically, the memory usage information of the preset storage structure in the database server is counted, and when it is determined that the number of WALs of the database server is greater than or equal to the preset number threshold, the first write-ahead log is determined based on the memory usage information of the preset storage structure, wherein the first write-ahead log is a write-ahead log in which the sum of the memory usage information of the preset storage structure contained is greater than or equal to the preset memory threshold. Thus, the database partition corresponding to the first write-ahead log is found, and then these database partitions are flushed. In the embodiment of the present application, a method for balancing the flushing of WALs of a database server is implemented by combining the memory usage of a preset storage structure, which solves the problem of being unable to release effective Memstore memory in the related art, improves the memory release efficiency in the database server, and improves the stability of the database server.
[0065] Further, in one embodiment of the present application, the processor 420 is specifically used to: determine N target storage structures according to the used memory information of the preset storage structure, where N is a positive integer; determine the second write-ahead logs corresponding to the N target storage structures respectively; and determine the first write-ahead log in the second write-ahead log according to the sum of the used memory information of the preset storage structure included in the second write-ahead log.
[0066] Further, in one embodiment of the present application, the processor 420 is also used to: when the sum of the used memory information of the preset storage structure included in the second write-ahead log is equal, determine the first write-ahead log in the second write-ahead log according to the log generation time of the second write-ahead log.
[0067] Furthermore, in one embodiment of the present application, the processor 420 is specifically configured to obtain memory usage information of a preset storage structure of each database partition of the database server.
[0068] Furthermore, in one embodiment of the present application, the processor 420 is further configured to determine a preset storage structure included in the write-ahead log.
[0069] It should be understood that in the embodiment of the present application, the input unit 408 may include a graphics processor (Graphics Processing Unit, GPU) 4082 and a microphone 4084, and the graphics processor 4082 processes the image data of the static picture or video obtained by the image capture device (such as a camera) in the video capture mode or the image capture mode. The display unit 412 may include a display panel 4122, and the display panel 4122 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 414 includes at least one of a touch panel 4142 and other input devices 4144. The touch panel 4142 is also called a touch screen. The touch panel 4142 may include two parts: a touch detection device and a touch controller. Other input devices 4144 may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which will not be repeated here.
[0070] The memory 418 can be used to store software programs and various data. The memory 418 may mainly include a first storage area for storing programs or instructions and a second storage area for storing data, wherein the first storage area may store an operating system, an application program or instructions required for at least one function (such as a sound playback function, an image playback function, etc.), etc. In addition, the memory 418 may include a volatile memory or a non-volatile memory, or the memory 418 may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), a static random access memory (SRAM), a dynamic random access memory (DRAM), a synchronous dynamic random access memory (SDRAM), a double data rate synchronous dynamic random access memory (DDRSDRAM), an enhanced synchronous dynamic random access memory (ESDRAM), a synchronous link dynamic random access memory (SLDRAM) and a direct memory bus random access memory (DRRAM). The memory 418 in the embodiment of the present application includes but is not limited to these and any other suitable types of memory.
[0071] The processor 420 may include one or more processing units; optionally, the processor 420 integrates an application processor and a modem processor, wherein the application processor mainly processes operations related to an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communication signals, such as a baseband processor. It is understandable that the modem processor may not be integrated into the processor 420.
[0072] The embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by the processor, each process of the above-mentioned pre-write log flushing method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0073] The processor is the processor in the electronic device in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.
[0074] The embodiment of the present application further provides a chip, which includes a processor and a communication interface, the communication interface and the processor are coupled, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned pre-write log flashing method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0075] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0076] An embodiment of the present application provides a computer program product, which is stored in a storage medium. The program product is executed by at least one processor to implement the various processes of the above-mentioned pre-write log flashing method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0077] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0078] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods of each embodiment of the present application.
[0079] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. A method for flushing a write-ahead log. It is characterized in that include: Obtaining memory usage information of a preset storage structure in a database server; When the number of write-ahead logs generated in the database server is greater than or equal to a preset number threshold, determining a first write-ahead log in the write-ahead log according to the memory usage information of the preset storage structure; Performing a flush process on the first write-ahead log; The determining, in the write-ahead log according to the used memory information of the preset storage structure, a first write-ahead log comprises: Determine N target storage structures according to the used memory information of the preset storage structure, where N is a positive integer; Determine the second write-ahead logs corresponding to the N target storage structures respectively; According to the sum of the used memory information of the preset storage structure included in the second write-ahead log, the second write-ahead log is sorted in descending order, and the first write-ahead log is determined in the second write-ahead log, wherein the first one or more of the write-ahead logs are the first write-ahead logs.
2. The method for flushing a write-ahead log according to claim 1, It is characterized in that Also includes: In a case where the sum of the used memory information of the preset storage structure included in the second write-ahead log is equal, the first write-ahead log is determined in the second write-ahead log according to the log generation time of the second write-ahead log.
3. The method for flushing a write-ahead log according to claim 1 or 2, It is characterized in that The obtaining of memory usage information of a preset storage structure in the database server includes: Obtaining memory usage information of the preset storage structure of each database partition of the database server.
4. The method for flushing a write-ahead log according to claim 1 or 2, It is characterized in that After obtaining the memory usage information of the preset storage structure in the database server, the method further includes: The preset storage structure included in the write-ahead log is determined.
5. A flashing device for pre-written logs, It is characterized in that include: An acquisition module is used to acquire memory usage information of a preset storage structure in a database server; A first determining module, configured to determine a first write-ahead log in the write-ahead log according to the used memory information of the preset storage structure when the number of write-ahead logs generated in the database server is greater than or equal to a preset number threshold; A flashing module, used for flashing the first write-ahead log; The first determining module is specifically configured to: Determine N target storage structures according to the used memory information of the preset storage structure, where N is a positive integer; Determine the second write-ahead logs corresponding to the N target storage structures respectively; According to the sum of the used memory information of the preset storage structure included in the second write-ahead log, the second write-ahead log is sorted in descending order, and the first write-ahead log is determined in the second write-ahead log, wherein the first one or more of the write-ahead logs are the first write-ahead logs.
6. The write-ahead log flashing device according to claim 5, It is characterized in that The first determining module is further used for: In a case where the sum of the used memory information of the preset storage structure included in the second write-ahead log is equal, the first write-ahead log is determined in the second write-ahead log according to the log generation time of the second write-ahead log.
7. The write-ahead log flashing device according to claim 5 or 6, It is characterized in that The acquisition module is specifically used to acquire the memory usage information of the preset storage structure of each database partition of the database server.
8. The write-ahead log flashing device according to claim 5 or 6, It is characterized in that Also includes: The second determining module is used to determine the preset storage structure included in the write-ahead log.
Citation Information
Patent Citations
Method and apparatus for data backup
CN109254870A
Database task processing method and device, electronic equipment and readable medium
CN112015713A