CN110737649B - Method, equipment and storage medium for processing transaction log of database - Google Patents
Method, equipment and storage medium for processing transaction log of database Download PDFInfo
- Publication number
- CN110737649B CN110737649B CN201910911371.8A CN201910911371A CN110737649B CN 110737649 B CN110737649 B CN 110737649B CN 201910911371 A CN201910911371 A CN 201910911371A CN 110737649 B CN110737649 B CN 110737649B
- Authority
- CN
- China
- Prior art keywords
- transaction
- transaction log
- log space
- space
- utilization rate
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 35
- 238000012545 processing Methods 0.000 title claims description 21
- 230000004044 response Effects 0.000 claims abstract description 19
- 238000003672 processing method Methods 0.000 claims abstract 2
- 238000004590 computer program Methods 0.000 claims description 14
- 230000006870 function Effects 0.000 description 6
- 230000003287 optical effect Effects 0.000 description 4
- 238000010586 diagram Methods 0.000 description 3
- 238000012544 monitoring process Methods 0.000 description 3
- 238000013461 design Methods 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 239000000835 fiber Substances 0.000 description 2
- 238000004519 manufacturing process Methods 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000008569 process Effects 0.000 description 2
- 230000001360 synchronised effect Effects 0.000 description 2
- 238000004458 analytical method Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 230000014509 gene expression Effects 0.000 description 1
- 230000005484 gravity Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/21—Design, administration or maintenance of databases
- G06F16/215—Improving data quality; Data cleansing, e.g. de-duplication, removing invalid entries or correcting typographical errors
Landscapes
- Engineering & Computer Science (AREA)
- Databases & Information Systems (AREA)
- Theoretical Computer Science (AREA)
- Quality & Reliability (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention discloses a processing method of a transaction log of a database, which comprises the following steps: acquiring and judging whether the utilization rate of the transaction log space is greater than a first threshold value or not; in response to the fact that the usage rate of the transaction log space is larger than a first threshold value, based on the fact that there are active large transactions, the proportion of the generated transaction logs in the transaction log space is not smaller than a preset proportion, the active large transactions are terminated; judging whether the utilization rate of the transaction log space is greater than a second threshold value after a preset time period; and responding to the fact that the utilization rate of the transaction log space is larger than a second threshold value, terminating a first transaction in the transaction queue, releasing a transaction log corresponding to the first transaction in the transaction log space, and returning to the first step. The invention also discloses a computer device and a readable storage medium. The method disclosed by the invention avoids the problem that the database cannot be used or even crashes caused by the fact that the service rate of the transaction log reaches 100%.
Description
Technical Field
The present invention relates to the field of databases, and in particular, to a method, a device, and a storage medium for processing a transaction log of a database.
Background
At present, data generated by application is mainly stored in a database for analysis, processing and processing, and the database prompts more and more enterprises to apply the data to a production environment due to the characteristics of safety, stability, high efficiency and the like, so that the operation cost of the enterprises is reduced. However, as the data volume is increased, the data volume carried by the database is more and more, and the problem that the database cannot be used due to the 100% transaction log utilization rate of the database is always troubling database administrators.
Therefore, a method for processing the transaction log of the database is urgently needed.
Disclosure of Invention
In view of the above, in order to overcome at least one aspect of the above problems, an embodiment of the present invention provides a method for processing a transaction log of a database, including:
acquiring and judging whether the utilization rate of a transaction log space is greater than a first threshold value or not;
in response to the fact that the utilization rate of the transaction log space is larger than the first threshold value, based on the fact that there are active large transactions of which the proportion of the generated transaction logs in the transaction log space is not smaller than a preset proportion, terminating the active large transactions;
judging whether the utilization rate of the transaction log space is greater than a second threshold value after a preset time period;
and in response to the fact that the utilization rate of the transaction log space is larger than a second threshold value, terminating a first transaction in a transaction queue, releasing a transaction log corresponding to the first transaction in the transaction log space, and returning to the step of judging whether the utilization rate of the transaction log space is larger than the first threshold value.
In some embodiments, terminating active large transactions for which the transaction log has been generated with a weight in the transaction log space that is not less than a preset weight, further comprises:
judging whether the active large transaction continuously generating a transaction log exists;
in response to there being the active large transaction that continues to generate a transaction log, terminating the active large transaction that continues to generate a transaction log.
In some embodiments, further comprising:
responding to the situation that no active large transaction continuously generating the transaction log exists, and acquiring and judging whether the utilization rate of the transaction log space is greater than a third threshold value or not after the preset time period;
responding to the fact that the utilization rate of the transaction log space is larger than the third threshold value, and judging whether active large transactions continuously generating transaction logs exist or not;
in response to there being an active large transaction that continues to generate a transaction log, terminating the active large transaction.
In some embodiments, further comprising:
and in response to the absence of the active large transaction, terminating the first transaction in the transaction queue and releasing the transaction log based on the utilization rate of the transaction log space being greater than the second threshold, and returning to the step of judging whether the utilization rate of the transaction log space is greater than the first threshold.
In some embodiments, terminating active large transactions for which the transaction log has been generated with a weight in the transaction log space that is not less than a preset weight, further comprises:
and performing rollback processing on the transaction log of the active large transaction.
In some embodiments, releasing the transaction log corresponding to the first transaction in the transaction log space further comprises:
responding to that the transaction logs corresponding to the second transaction to the Nth transaction in the transaction queue are rolled back, and releasing the transaction logs corresponding to the second transaction to the N transactions;
deleting the first transaction to the Nth transaction in the transaction queue.
In some embodiments, further comprising:
and responding to the fact that the utilization rate of the transaction log space is not larger than the first threshold value, after the preset time period, returning to the step to judge whether the utilization rate of the transaction log space is larger than the first threshold value or not.
In some embodiments, obtaining and determining whether the usage of the transaction log space is greater than a first threshold further comprises:
acquiring the size of a transaction log generated by each transaction in the transaction queue and the size of a transaction log space;
and obtaining the utilization rate of the transaction log space according to the size of the transaction log generated by each transaction in the transaction queue and the size of the transaction log space.
Based on the same inventive concept, according to another aspect of the present invention, an embodiment of the present invention further provides a computer apparatus, including:
at least one processor; and
a memory storing a computer program operable on the processor, wherein the processor executes the program to perform the steps of the method for processing a transaction log of any of the databases as described above.
Based on the same inventive concept, according to another aspect of the present invention, an embodiment of the present invention further provides a computer-readable storage medium storing a computer program, which when executed by a processor performs the steps of the method for processing the transaction log of any one of the databases as described above.
The invention has one of the following beneficial technical effects: the method disclosed by the invention terminates the large transaction and releases the transaction log of the first transaction when the space utilization rate of the transaction log is greater than the first threshold value or the second threshold value by monitoring the space utilization rate of the transaction log, thereby avoiding the problem that the database cannot be used or even crashes caused by the utilization rate of the transaction log reaching 100%.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other embodiments can be obtained by using the drawings without creative efforts.
Fig. 1 is a schematic flowchart of a method for processing a transaction log of a database according to an embodiment of the present invention;
fig. 2 is a flowchart illustrating a method for processing a transaction log of a database according to an embodiment of the present invention;
FIG. 3 is a schematic structural diagram of a computer device provided in an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a computer-readable storage medium according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the following embodiments of the present invention are described in further detail with reference to the accompanying drawings.
It should be noted that all expressions using "first" and "second" in the embodiments of the present invention are used for distinguishing two entities with the same name but different names or different parameters, and it should be noted that "first" and "second" are merely for convenience of description and should not be construed as limitations of the embodiments of the present invention, and they are not described in any more detail in the following embodiments.
According to an aspect of the present invention, an embodiment of the present invention provides a method for processing a transaction log of a database, as shown in fig. 1, which may include the steps of: s1, acquiring and judging whether the utilization rate of a transaction log space is greater than a first threshold value or not; s2, in response to the fact that the utilization rate of the transaction log space is larger than the first threshold value, based on the fact that active large transactions exist, wherein the proportion of the generated transaction logs in the transaction log space is not smaller than the preset proportion, the active large transactions are terminated; s3, judging whether the utilization rate of the transaction log space is greater than a second threshold value after a preset time period; s4, responding to the fact that the utilization rate of the transaction log space is larger than a second threshold value, terminating the first transaction in the transaction queue, releasing the transaction log corresponding to the first transaction in the transaction log space, and returning to the step to judge whether the utilization rate of the transaction log space is larger than the first threshold value.
The method stops the big transaction and releases the transaction log of the first transaction when the space utilization rate of the transaction log is greater than the first threshold value or the second threshold value by monitoring the space utilization rate of the transaction log, thereby avoiding the problem that the database cannot be used or even is down caused by the utilization rate of the transaction log reaching 100 percent.
The following is a detailed description of a method for processing a transaction log of a database in conjunction with a flow diagram shown in fig. 2.
Firstly, step S1 is performed to obtain and judge whether the usage rate of the transaction log space is greater than a first threshold.
Specifically, the size of the transaction log generated by each transaction in the transaction queue and the size of the transaction log space need to be obtained, and then the utilization rate of the transaction log space is obtained according to the size of the transaction log generated by each transaction in the transaction queue and the size of the transaction log space.
For example, transaction 1, transaction 2, transaction 3, transaction 4 and transaction 5 arranged in sequence in the transaction queue need to calculate the utilization rate of the transaction log space at this time according to the total size of the transaction logs generated by transaction 1, transaction 2, transaction 3, transaction 4 and transaction 5 and the total size of the transaction log space.
It should be noted that, as long as the transaction 1, the transaction 2, the transaction 3, the transaction 4, and the transaction 5 are in an active state, more and more transaction logs are generated over time, and therefore, the usage rate of the transaction log space changes over time.
And then different processing is performed according to the judgment result.
As shown in fig. 2, in some embodiments, when the usage rate of the transaction log space is not greater than the first threshold, after the preset time period elapses, the usage rate of the transaction log space is continuously obtained, so as to return to the step of determining whether the usage rate of the transaction log space is greater than the first threshold.
For example, if the usage rate of the transaction log space corresponding to the total size of the transaction logs generated at this time in the transaction 1, the transaction 2, the transaction 3, the transaction 4, and the transaction 5 is not greater than the first threshold, the determination is performed again after a preset time period.
In some embodiments, the first threshold may be 50%, and the preset time period may be set according to the speed and the number of logs generated by the actual transaction, for example, if the logs generated by the transaction are faster and the number of logs generated by the transaction is larger, the preset time period may be set to be relatively smaller, and vice versa.
In some embodiments, when the usage rate of the transaction log space is greater than the first threshold, step S2 is performed, in response to that the usage rate of the transaction log space is greater than the first threshold, based on the existence of an active large transaction whose proportion of the generated transaction log in the transaction log space is not less than a preset proportion, terminating the active large transaction, and performing rollback processing on the transaction log of the active large transaction.
It should be noted that the large transaction is a transaction with a large generated transaction log, and the proportion of the generated transaction log in the transaction log space is not less than the preset proportion, at this time, if the usage rate of the transaction log space exceeds the first threshold and the transaction log is swelled due to the existence of the active large transaction, the active large transaction is terminated.
In some embodiments, the predetermined specific gravity may be 40%. I.e., transactions that have generated transaction logs that account for more than 40% of the transaction log space may be considered large transactions.
In some embodiments, in step S2, a determination of whether there is an active large transaction may be further included, as shown in fig. 2, determining whether there is the active large transaction that continues to generate a transaction log; in response to the existence of the active large transaction continuously generating the transaction log, terminating the active large transaction continuously generating the transaction log, and performing rollback processing on the transaction log of the active large transaction.
At this time, step S3 is performed to determine whether the usage rate of the transaction log space is greater than a second threshold after a preset time period, and step S4 is performed to terminate the first transaction in the transaction queue and release the transaction log corresponding to the first transaction in the transaction log space in response to the fact that the usage rate of the transaction log space is greater than the second threshold, and the step is returned to determine whether the usage rate of the transaction log space is greater than the first threshold.
In some embodiments, releasing the transaction log corresponding to the first transaction in the transaction log space may further include: in response to the transaction logs corresponding to the second to nth transactions in the transaction queue having been rolled back, releasing the transaction logs corresponding to the second to nth transactions; deleting the first to Nth transactions in the transaction queue. And performing rollback processing on the transaction log of the active large transaction.
For example, when transaction 4 in transaction 1, transaction 2, transaction 3, transaction 4 and transaction 5 sequentially arranged in the transaction queue is a large transaction and is terminated in step S2, and the total amount of the transaction logs generated by the remaining transaction 1, transaction 2, transaction 3 and transaction 5 results in the usage rate of the transaction logs being greater than the second threshold, then transaction 1 is terminated and the transaction log corresponding to transaction 1 in the transaction space is released. Meanwhile, if the transaction logs corresponding to the transactions 2 and 3 have been rolled back, the transaction logs corresponding to the transactions 2 and 3 may be released together. At this time, the transaction 1, the transaction 2 and the transaction 3 in the transaction queue are deleted, the transaction 4 is the first transaction, meanwhile, a new transaction can be added into the transaction queue, and whether the log quantity generated by the transaction in the new transaction queue is larger than the first threshold value is continuously judged.
It should be noted that, regardless of whether the subsequent transaction has been terminated, the transaction log corresponding to the subsequent transaction can be released only when the first transaction is terminated and the transaction log rollback is completed and the transaction log space is released. Generally, non-big transaction rollback consumes little time, and big transaction rollback consumes longer time.
In some embodiments, as shown in fig. 2, when determining whether there is an active large transaction in step S2, in response to that there is no active large transaction that continues to generate a transaction log, after the preset time period elapses, obtaining and determining whether a usage rate of a transaction log space is greater than a third threshold; responding to the fact that the utilization rate of the transaction log space is larger than the third threshold value, and judging whether active large transactions continuously generating transaction logs exist or not; in response to there being an active large transaction that continues to generate transaction logs, the active large transaction is terminated and step S3 continues.
It should be noted that, although a transaction is not determined as a large transaction at the time of the first determination, the amount of the transaction log generated by the transaction meets the standard of the large transaction as time passes, and therefore, the second determination needs to be performed after the usage rate of the transaction log space is greater than the first threshold value and the determination of whether the first large transaction exists is performed. That is, when the usage rate of the transaction log space is greater than the third threshold, the determination of whether there is an active large transaction is made again.
For example, when the transaction 3 determines whether the usage rate of the transaction log space is greater than the first threshold, the amount of the generated transaction log does not meet the standard of the large transaction, and the transaction 3 is not terminated, and when the usage rate of the transaction log space is greater than the third threshold, the amount of the generated transaction log meets the standard of the large transaction, and at this time, the transaction 3 may be terminated.
Thus, by judging twice, it can be prevented that a large transaction is not judged due to time and is not terminated.
In some embodiments, the third threshold may be 60%.
In some embodiments, if it is determined that there is no active large transaction in both of the two determinations, when the usage rate of the transaction log space is greater than the second threshold, the first transaction in the transaction queue is terminated, the transaction log corresponding to the first transaction in the transaction log space is released, and the step of returning is performed to determine whether the usage rate of the transaction log space is greater than the first threshold.
For example, when the total amount of the transaction logs generated by the transactions 1, 2, 3, 4 and 5 arranged in sequence in the transaction queue causes the usage rate of the transaction logs to be greater than the second threshold, the transaction 1 is terminated, and the transaction log corresponding to the transaction 1 in the transaction space is released. Meanwhile, if the transaction logs corresponding to the transactions 2 and 3 have been rolled back, the transaction logs corresponding to the transactions 2 and 3 can be released together. At this time, the transaction 1, the transaction 2 and the transaction 3 in the transaction queue are deleted, the transaction 4 is the first transaction, meanwhile, a new transaction can be added into the transaction queue, and the process of continuously returning and judging whether the log quantity generated by the transaction in the new transaction queue is larger than the first threshold value or not is continued.
In some embodiments, after the detailed information of the large transaction is extracted, the background terminates the large transaction and generates a detailed report to be sent to a database administrator, and the database administrator diagnoses the database according to the detailed report provided by the program so as to adjust the size of the database log and submit the detailed service information to the front-end user; and the front-end user modifies the service logic according to the program report so as to reduce the transaction failure rate and improve the production efficiency. And the problem that more data is lost once the log file is damaged if the transaction log space is infinitely enlarged is also solved.
The method disclosed by the invention terminates the large transaction and releases the transaction log of the first transaction when the space utilization rate of the transaction log is greater than the first threshold value or the second threshold value by monitoring the space utilization rate of the transaction log, thereby avoiding the problem that the database cannot be used or even crashes caused by the utilization rate of the transaction log reaching 100%.
Based on the same inventive concept, according to another aspect of the present invention, as shown in fig. 3, an embodiment of the present invention further provides a computer apparatus 501, comprising:
at least one processor 520; and
the memory 510, the memory 510 stores a computer program 511 operable on the processor, and the processor 520 executes the program to perform the steps of the method for processing the transaction log of the database as described above.
Based on the same inventive concept, according to another aspect of the present invention, as shown in fig. 4, an embodiment of the present invention further provides a computer-readable storage medium 601, where the computer-readable storage medium 601 stores computer program instructions 610, and when executed by a processor, the computer program instructions 610 perform the steps of the method for processing the transaction log of the database as any one of the above.
Finally, it should be noted that, as will be understood by those skilled in the art, all or part of the processes of the methods of the above embodiments may be implemented by a computer program to instruct related hardware to implement the methods. The storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), a Random Access Memory (RAM), or the like. The embodiments of the computer program may achieve the same or similar effects as any of the above-described method embodiments.
In addition, the apparatuses, devices, and the like disclosed in the embodiments of the present invention may be various electronic terminal devices, such as a mobile phone, a Personal Digital Assistant (PDA), a tablet computer (PAD), a smart television, and the like, or may be a large terminal device, such as a server, and the like, and therefore the scope of protection disclosed in the embodiments of the present invention should not be limited to a specific type of apparatus, device. The client disclosed by the embodiment of the invention can be applied to any one of the electronic terminal devices in the form of electronic hardware, computer software or a combination of the electronic hardware and the computer software.
Furthermore, the method disclosed according to an embodiment of the present invention may also be implemented as a computer program executed by a CPU, and the computer program may be stored in a computer-readable storage medium. The computer program, when executed by the CPU, performs the above-described functions defined in the method disclosed in the embodiments of the present invention.
Further, the above method steps and system elements may also be implemented using a controller and a computer readable storage medium for storing a computer program for causing the controller to implement the functions of the above steps or elements.
Further, it should be appreciated that the computer-readable storage media (e.g., memory) herein can be either volatile memory or nonvolatile memory, or can include both volatile and nonvolatile memory. By way of example, and not limitation, nonvolatile memory can include Read Only Memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM), which can act as external cache memory. By way of example and not limitation, RAM is available in a variety of forms such as synchronous RAM (DRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchlink DRAM (SLDRAM), and Direct Rambus RAM (DRRAM). The storage devices of the disclosed aspects are intended to comprise, without being limited to, these and other suitable types of memory.
Those of skill would further appreciate that the various illustrative logical blocks, modules, circuits, and algorithm steps described in connection with the disclosure herein may be implemented as electronic hardware, computer software, or combinations of both. To clearly illustrate this interchangeability of hardware and software, various illustrative components, blocks, modules, circuits, and steps have been described above generally in terms of their functionality. Whether such functionality is implemented as software or hardware depends upon the particular application and design constraints imposed on the overall system. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the disclosed embodiments of the present invention.
The various illustrative logical blocks, modules, and circuits described in connection with the disclosure herein may be implemented or performed with the following components designed to perform the functions herein: a general purpose processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or any combination of these components. A general purpose processor may be a microprocessor, but in the alternative, the processor may be any conventional processor, controller, microcontroller, or state machine. A processor may also be implemented as a combination of computing devices, e.g., a combination of a DSP and a microprocessor, a plurality of microprocessors, one or more microprocessors in conjunction with a DSP, and/or any other such configuration.
The steps of a method or algorithm described in connection with the disclosure herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in RAM memory, flash memory, ROM memory, EPROM memory, EEPROM memory, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor such the processor can read information from, and write information to, the storage medium. In the alternative, the storage medium may be integral to the processor. The processor and the storage medium may reside in an ASIC. The ASIC may reside in a user terminal. In the alternative, the processor and the storage medium may reside as discrete components in a user terminal.
In one or more exemplary designs, the functions may be implemented in hardware, software, firmware, or any combination thereof. If implemented in software, the functions may be stored on or transmitted over as one or more instructions or code on a computer-readable medium. Computer-readable media includes both computer storage media and communication media including any medium that facilitates transfer of a computer program from one place to another. A storage media may be any available media that can be accessed by a general purpose or special purpose computer. By way of example, and not limitation, such computer-readable media can comprise RAM, ROM, EEPROM, CD-ROM or other optical disk storage, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a general-purpose or special-purpose computer, or a general-purpose or special-purpose processor. Also, any connection is properly termed a computer-readable medium. For example, if the software is transmitted from a website, server, or other remote source using a coaxial cable, fiber optic cable, twisted pair, digital Subscriber Line (DSL), or wireless technologies such as infrared, radio, and microwave, then the coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave are included in the definition of medium. Disk and disc, as used herein, includes Compact Disc (CD), laser disc, optical disc, digital Versatile Disc (DVD), floppy disk, blu-ray disc where disks usually reproduce data magnetically, while discs reproduce data optically with lasers. Combinations of the above should also be included within the scope of computer-readable media.
The foregoing is an exemplary embodiment of the present disclosure, but it should be noted that various changes and modifications could be made herein without departing from the scope of the present disclosure as defined by the appended claims. The functions, steps and/or actions of the method claims in accordance with the disclosed embodiments described herein need not be performed in any particular order. Furthermore, although elements of the embodiments of the invention may be described or claimed in the singular, the plural is contemplated unless limitation to the singular is explicitly stated.
It should be understood that, as used herein, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly supports the exception. It should also be understood that "and/or" as used herein is meant to include any and all possible combinations of one or more of the associated listed items.
The numbers of the embodiments disclosed in the above embodiments of the present invention are merely for description, and do not represent the advantages or disadvantages of the embodiments.
It will be understood by those skilled in the art that all or part of the steps of implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
Those of ordinary skill in the art will understand that: the discussion of any embodiment above is meant to be exemplary only, and is not intended to intimate that the scope of the disclosure, including the claims, of embodiments of the invention is limited to these examples; within the idea of an embodiment of the invention, also combinations between technical features in the above embodiments or in different embodiments are possible, and there are many other variations of the different aspects of the embodiments of the invention as described above, which are not provided in detail for the sake of brevity. Therefore, any omissions, modifications, substitutions, improvements, and the like that may be made without departing from the spirit and principles of the embodiments of the present invention are intended to be included within the scope of the embodiments of the present invention.
Claims (9)
1. A processing method of transaction logs of a database comprises the following steps:
acquiring and judging whether the utilization rate of a transaction log space is greater than a first threshold value or not;
in response to the usage rate of the transaction log space being greater than the first threshold, terminating the active large transaction based on the existence of the active large transaction of which the proportion of the generated transaction log in the transaction log space is not less than a preset proportion;
judging whether the utilization rate of the transaction log space is greater than a second threshold value after a preset time period;
in response to the fact that the utilization rate of the transaction log space is larger than a second threshold value, terminating a first transaction in a transaction queue, releasing a transaction log corresponding to the first transaction in the transaction log space, and returning to the step of judging whether the utilization rate of the transaction log space is larger than the first threshold value or not;
terminating the active large transactions of which the proportion of the generated transaction logs in the transaction log space is not less than the preset proportion, and further comprising the following steps:
judging whether the active large transaction continuously generating a transaction log exists;
in response to there being the active large transaction that continues to generate a transaction log, terminating the active large transaction that continues to generate a transaction log.
2. The method of claim 1, further comprising:
responding to the absence of the active large transaction which continuously generates the transaction log, and acquiring and judging whether the utilization rate of the transaction log space is greater than a third threshold value after the preset time period;
responding to the fact that the utilization rate of the transaction log space is larger than the third threshold value, and judging whether active large transactions continuously generating transaction logs exist or not;
in response to there being an active large transaction that continues to generate a transaction log, terminating the active large transaction.
3. The method of claim 2, further comprising:
and in response to the absence of the active large transaction, terminating the first transaction in the transaction queue and releasing the transaction log based on the utilization rate of the transaction log space being greater than the second threshold, and returning to the step of judging whether the utilization rate of the transaction log space is greater than the first threshold.
4. The method of claim 1, wherein terminating active large transactions for which a transaction log has been generated that has a weight in the transaction log space that is not less than a preset weight, further comprises:
and performing rollback processing on the transaction log of the active large transaction.
5. The method of claim 4, wherein releasing the transaction log in the transaction log space corresponding to the first transaction further comprises:
in response to the transaction logs corresponding to the second to nth transactions in the transaction queue having been rolled back, releasing the transaction logs corresponding to the second to nth transactions;
deleting the first transaction to the Nth transaction in the transaction queue.
6. The method of claim 1, further comprising:
and responding to the fact that the utilization rate of the transaction log space is not larger than the first threshold, and after the preset time period, returning to the step to judge whether the utilization rate of the transaction log space is larger than the first threshold or not.
7. The method of claim 1, wherein obtaining and determining whether a usage of transaction log space is greater than a first threshold further comprises:
acquiring the size of a transaction log generated by each transaction in the transaction queue and the size of a transaction log space;
and obtaining the utilization rate of the transaction log space according to the size of the transaction log generated by each transaction in the transaction queue and the size of the transaction log space.
8. A computer device, comprising:
at least one processor; and
memory storing a computer program operable on the processor, wherein the processor executes the program to perform the steps of the method according to any of claims 1-7.
9. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910911371.8A CN110737649B (en) | 2019-09-25 | 2019-09-25 | Method, equipment and storage medium for processing transaction log of database |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910911371.8A CN110737649B (en) | 2019-09-25 | 2019-09-25 | Method, equipment and storage medium for processing transaction log of database |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110737649A CN110737649A (en) | 2020-01-31 |
CN110737649B true CN110737649B (en) | 2023-01-06 |
Family
ID=69269580
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910911371.8A Active CN110737649B (en) | 2019-09-25 | 2019-09-25 | Method, equipment and storage medium for processing transaction log of database |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110737649B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112148479B (en) * | 2020-09-04 | 2024-03-19 | 杭州安恒信息技术股份有限公司 | Data processing method, device and computer equipment based on Siddi log audit |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105989139A (en) * | 2015-02-27 | 2016-10-05 | 阿里巴巴集团控股有限公司 | Affair synchronization method and equipment |
CN107180051A (en) * | 2016-03-11 | 2017-09-19 | 华为技术有限公司 | A kind of blog management method, server |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9715669B2 (en) * | 2010-04-27 | 2017-07-25 | International Business Machines Corporation | Monitoring and reporting productivity in enterprise environment |
-
2019
- 2019-09-25 CN CN201910911371.8A patent/CN110737649B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105989139A (en) * | 2015-02-27 | 2016-10-05 | 阿里巴巴集团控股有限公司 | Affair synchronization method and equipment |
CN107180051A (en) * | 2016-03-11 | 2017-09-19 | 华为技术有限公司 | A kind of blog management method, server |
Also Published As
Publication number | Publication date |
---|---|
CN110737649A (en) | 2020-01-31 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US20200327551A1 (en) | Resource transferring monitoring method and device | |
US20230350774A1 (en) | Methods and systems for determining system capacity | |
CN110795257A (en) | Method, device and equipment for processing multi-cluster operation records and storage medium | |
CN113535721A (en) | Data writing method and device | |
KR20160056944A (en) | Acceleration based on cached flows | |
US20200210411A1 (en) | Data storage in blockchain-type ledger | |
US20230030856A1 (en) | Distributed table storage processing method, device and system | |
JP2021523429A (en) | Automatic database query load assessment and adaptive processing | |
CN116049109A (en) | File verification method, system, equipment and medium based on filter | |
WO2019140738A1 (en) | Method for avoiding excess return visits, and electronic apparatus and computer-readable storage medium | |
CN110737649B (en) | Method, equipment and storage medium for processing transaction log of database | |
US9298499B2 (en) | Identifier generation using named objects | |
CN111090621A (en) | Log obtaining method, device and storage medium | |
CN111708664A (en) | Log management method, device and medium for client | |
CN106612263B (en) | Method and equipment for processing application access request | |
CN111176932B (en) | Method and device for recording abnormal event log and readable medium | |
WO2021174882A1 (en) | Data fragment verification method, apparatus, computer device, and readable storage medium | |
CN113010376A (en) | Method and device for monitoring cloud storage system for storing training data | |
CN111309264A (en) | Method, system, device and medium for making directory quota compatible with snapshot | |
US20190297144A1 (en) | Method and system for improved distributed data storage amongst multiple computing nodes | |
CN111736991B (en) | Method, device and equipment for scheduling cloud platform resources and readable medium | |
US11086849B2 (en) | Methods and systems for reading data based on plurality of blockchain networks | |
US20200177390A1 (en) | Providing data verification in a blockchain ledger | |
TWI734151B (en) | Parameter synchronization method, device, and storage medium | |
CN111338792B (en) | Cluster resource release method, device and medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |