CN115481094A - Log processing method and device - Google Patents

Log processing method and device Download PDF

Info

Publication number
CN115481094A
CN115481094A CN202211216826.2A CN202211216826A CN115481094A CN 115481094 A CN115481094 A CN 115481094A CN 202211216826 A CN202211216826 A CN 202211216826A CN 115481094 A CN115481094 A CN 115481094A
Authority
CN
China
Prior art keywords
log
transaction
autonomous
database table
error
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.)
Pending
Application number
CN202211216826.2A
Other languages
Chinese (zh)
Inventor
申世哲
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Bank of China Ltd
Original Assignee
Bank of China Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Bank of China Ltd filed Critical Bank of China Ltd
Priority to CN202211216826.2A priority Critical patent/CN115481094A/en
Publication of CN115481094A publication Critical patent/CN115481094A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/18File system types
    • G06F16/1805Append-only file systems, e.g. using logs or journals to store data
    • G06F16/1815Journaling file systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • G06F16/164File meta data generation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/172Caching, prefetching or hoarding of files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2308Concurrency control
    • G06F16/2315Optimistic concurrency control
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/466Transaction processing

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Software Systems (AREA)
  • Human Computer Interaction (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application provides a log processing method and a log processing device, wherein the log processing method comprises the following steps: declaring an autonomous transaction and a log database table in a background application program when the transaction is initiated; when the abnormal operation of the program is detected, recording an error log by using the autonomous transaction, and suspending the main transaction; and updating the error log into the log database table, and recovering the main transaction after the autonomous transaction is submitted or returned. By using the method and the device, the application log recording function can be realized through the autonomous transaction, so that the recording of the error log is not influenced by the rollback of the main transaction, and the main program is not depended on or interfered.

Description

Log processing method and device
Technical Field
The present application relates to application log technologies, and in particular, to a log processing method and apparatus.
Background
In the background processing procedure of the bank, the function of log recording is usually realized, especially the error log when the transaction has an error. Current host platforms typically use VSAM files as a log carrier, which can be set to unrecoverable mode, so that the application log is recorded regardless of whether the transaction was last rollback or commit. For an open platform, although the function similar to VSAM can be realized by using the SFS file, after all, the SFS file is a non-master file system, so the operation performance of the SFS file is low, and similar applications are hardly available. Since logging is relatively frequent for file operations, the use of SFS files, for example, is highly likely to result in unpredictable anomalies.
Disclosure of Invention
An object of the present application is to provide a log processing method, which can implement an application log recording function through an autonomous transaction. Another object of the present application is to provide a log processing system. It is a further object of the present application to provide a computer apparatus. It is a further object of this application to provide a readable medium.
In order to achieve the above object, an aspect of the present application discloses a log processing method, including:
declaring an autonomous transaction and a log database table in a background application program when the transaction is initiated;
when the abnormal operation of the program is detected, recording an error log by using the autonomous transaction, and suspending the main transaction;
and updating the error log into the log database table, and recovering the main transaction after the autonomous transaction is submitted or returned.
Further, the log processing method further includes:
and creating a sequence, and generating and storing a log sequence number of the transaction by using the sequence.
Further, the log processing method further includes:
and generating and storing the log sequence number in a mode of increasing the log database table date + the current date number.
Further, recording an error log using the autonomous transaction, comprising:
generating a log number of a transaction by using an autonomous transaction, and writing the log number into a corresponding error log, wherein each step of log of each transaction corresponds to one number;
and writing the log serial number and the log number into a log table.
Further, the updating the error log into the log database table and recovering the primary transaction after the autonomous transaction executes commit or rollback includes:
updating an error log into the log database table by using SQL through an autonomous transaction;
committing commit to the log database table by the SQL updating operation autonomous transaction;
the primary transaction is resumed after the autonomous transaction performs commit or rollback.
Further, declaring autonomous transactions in a background application, comprising:
the autonomous transaction is declared using the command to declare the autonomous transaction provided by ORACLE.
In order to achieve the above object, an aspect of the present application discloses a log processing apparatus, including:
the declaration unit is used for declaring the autonomous affair and the log database table in a background application program when the affair is initiated;
the log recording unit is used for recording an error log by using the autonomous transaction and suspending the main transaction when the abnormal operation of the program is detected;
and the log updating unit is used for updating the error log into the log database table and recovering the main transaction after the execution of the autonomous transaction is submitted or returned.
Further, the log processing apparatus further includes:
and the first log sequence generation unit is used for creating a sequence, generating a log sequence of the transaction by using the sequence and storing the log sequence.
Further, the log processing apparatus further includes:
and the second log sequence number generation unit is used for generating and storing the log sequence number in a mode of increasing the date of the log database table and the current date number.
Further, the logging unit includes:
the log number generating module is used for generating a log number of the transaction by using the autonomous transaction and writing the log number into a corresponding error log, wherein each step of log of each transaction corresponds to one number;
and the information writing module is used for writing the log serial number and the log number into a log table.
Further, the log update unit includes:
the updating module is used for updating the error log into the log database table by using SQL through autonomous transactions;
the submitting module is used for submitting commit to the log database table through SQL updating operation autonomous transactions;
and the main affair recovery module is used for recovering the main affair after the autonomous affair is submitted or returned.
Further, the declaration unit is specifically configured to: the autonomous transaction is declared using the command to declare the autonomous transaction provided by ORACLE.
To achieve the above object, one aspect of the present application discloses a computer device including a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing the method when executing the program.
To achieve the above object, an aspect of the present application discloses a computer-readable medium on which a computer program is stored, which when executed by a processor, implements the method.
By using the log processing method and device provided by the application, the application log recording function can be realized through autonomous transactions, so that the recording of error logs cannot be influenced due to the rollback of the main transaction, and the main program is not depended on or interfered.
Drawings
In order to more clearly illustrate the embodiments of the present application 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, it is obvious that the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a flowchart of a log processing method according to an embodiment of the present application;
fig. 2 is a flowchart of a specific embodiment S102 of the log processing method of the present application;
fig. 3 is a flowchart of a log processing method according to a specific embodiment S103 of the present application;
FIG. 4 is a detailed flowchart of a log processing method according to an embodiment of the present application;
fig. 5 is a block diagram of a log processing apparatus according to an embodiment of the present application;
fig. 6 is a block diagram of a log processing apparatus according to an embodiment of the present application;
fig. 7 is a block diagram of a structure of a log updating unit 503 of the log processing apparatus according to the embodiment of the present application;
FIG. 8 shows a schematic block diagram of a computer device suitable for use in implementing embodiments of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
It should be noted that the log processing method and system disclosed in the present application can be used in the financial field, and can also be used in any field other than the financial field.
Fig. 1 is a flowchart of a log processing method according to an embodiment of the present application, and as shown in fig. 1, the log processing method includes:
s101: when an transaction is initiated, declaring an autonomous transaction and a log database table in a background application program;
in particular implementation, the embedded PL/SQL autonomous transaction can be used to declare the log database table that is used to record error logs.
Declaring an AUTONOMOUS TRANSACTION can be implemented by declaring a PRAGMA AUTONOMOUS _ TRANSACTION AUTONOMOUS TRANSACTION statement, in which a COMMIT needs to be lifted separately. The autonomous transaction is declared using the command to declare the autonomous transaction provided by ORACLE.
S102: when the abnormal operation of the program is detected, recording an error log by using the autonomous transaction, and suspending the main transaction;
if the program runs normally, the autonomous transaction is directly transacted without triggering the autonomous transaction, a transaction result is generated, and the submission of the primary transaction is completed.
If a program is detected to be running abnormally, an ORACLE autonomous transaction logging error log can be implemented using embedded PL/SQL. During the autonomous transaction, the primary transaction is suspended temporarily and it is necessary to wait until the autonomous transaction executes a COMMIT or ROLLBACK before resuming the execution of the primary transaction.
S103: and updating the error log into the log database table, and recovering the main transaction after the autonomous transaction is submitted or returned.
Autonomous transactions may commit or rollback independently of invoking a primary transaction, where consideration needs to be given to whether processing associated with the primary transaction is required based on the criticality of the autonomous transaction. Since the autonomous transaction is relatively critical and is not expected to be related to the transaction consistency of the primary transaction, the autonomous transaction is independent of the primary transaction, but needs to have a correlation relationship in the process.
The main execution body of the log processing method shown in fig. 1 is a bank acquired server, which is not limited in this application.
According to the log processing method, when a transaction is initiated, an autonomous transaction and a log database table are declared in a background application program, when the abnormal operation of the program is detected, an error log is recorded by using the autonomous transaction, and a main transaction is suspended; and updating the error log into the log database table, and recovering the main transaction after the autonomous transaction is submitted or returned. By using the method, the application log recording function can be realized through the autonomous transaction, so that the recording of the error log is not influenced by the rollback of the main transaction, and the main program is not depended on or interfered.
In one embodiment, as shown in fig. 2, the recording an error log using an autonomous transaction in step S102 includes:
s201: generating a log number of a transaction by using an autonomous transaction, and writing the log number into a corresponding error log;
the log number of the 1 st log is 1, the log number of the 2 nd log is 2, and the log number of the nth log is n.
S202: and writing the pre-generated log serial number and the log number into a log table.
The log sequence number is mainly used for identifying the sequence of log recording, and the log can be conveniently checked by utilizing the log sequence number. The log serial number and the log number form a unique key value of the log, and the unique key value is used for identifying the log.
The log sequence number may be generated in various ways, and in an embodiment, the log sequence number of the transaction may be generated in a sequence. When the method is implemented specifically, a sequence is created by using the ORACLE, a log sequence of a transaction is generated by using the sequence, and the log sequence is stored in the sequence.
In another embodiment, instead of creating the sequence, a log database table date + current day number may be incremented to generate a log sequence number through ORACLE and store the log sequence number. Compared with the method for generating the log serial number of the transaction by using the sequence, the effectiveness of the method cannot be compared with that of the sequence, and the maximum serial number of the database at the last time needs to be inquired by using a mode of increasing the serial number at the current day, so that the inquiry burden is easily increased.
In one embodiment, as shown in fig. 3, updating the error log into the log database table in S103, and recovering the main transaction after the autonomous transaction performs commit or rollback includes:
s301: updating an error log into the log database table by using SQL through an autonomous transaction;
it should be noted that the autonomous transaction is an independent transaction that is started on the primary transaction separately, and in order to avoid mutual influence, the primary transaction is temporarily suspended during the autonomous transaction processing.
Autonomous transactions may commit or rollback independently of invoking a primary transaction, where consideration needs to be given to whether processing associated with the primary transaction is required based on the criticality of the autonomous transaction. Since the autonomous transaction is relatively critical and does not want to be related to the transaction consistency of the primary transaction, the autonomous transaction is independent of the primary transaction, but needs to have a correlation relationship in the process.
S302: committing a COMMIT to the log database table from a transaction by an SQL update operation;
in order to ensure the execution of a complete flow of the correct creation of a log database table, the correct declaration of an ORACLE autonomous transaction in a program, the normal triggering of the autonomous transaction and the like, a COMMIT operation is not submitted when the autonomous transaction is declared.
S303: the primary transaction is resumed after the autonomous transaction performs commit or rollback.
In an embodiment, the autonomous transaction is declared in the background application, and the autonomous transaction may be declared by using a command for declaring the autonomous transaction provided by ORACLE, which is not limited in this application.
It should be noted that, the present application can process different error logs according to different requirements, and ensure independence of different dates and different numbers of strokes.
By using the log processing method, the log recording function can be realized through AUTONOMOUS TRANSACTIONs, so that the recording of the error log is not influenced by the rollback of the main TRANSACTION, the main program is not depended on or interfered, the recording of the error log is more convenient, the PRAGMA AUTONOMOUS _ TRANSACTION AUTONOMOUS TRANSACTION is added in the storage process of the program, and the submission or the rollback in the storage process is only effective for the storage process. The method has the advantages that the recording of error logs cannot be influenced by the rollback of the main transaction, and the characteristics of the autonomous transaction do not depend on or interfere with the main program.
The log processing party of the application adopts an ORACLE autonomous transaction mechanism, cancels a mode of using a file as a carrier, records the log in a database, and can facilitate subsequent query and analysis. When the DML operation is executed on the log table record of the database, on one hand, an error needs to be recorded in the log table of the database, and on the other hand, because the error needs to rollback a main transaction, an autonomous transaction can be used in the storage process of the log record, the log record function can be conveniently realized by using the autonomous transaction, and the influence of the main transaction is avoided. The autonomy affair breaks through the limit of atomicity, and opens one autonomy affair in one main affair, thus the success and the failure of the autonomy affair can be controlled no matter the main affair fails or succeeds.
For the purpose of clarity, the following description is made with reference to specific examples. Fig. 4 is a detailed flowchart of a log processing method according to the present application, and as shown in fig. 4, the log processing method includes:
s401: a sequence is created. Sequence sequences may be created with ORACLE to generate and store log sequence numbers.
S402: a log database table is created.
A log database table may be created with ORACLE and used to record a log for recording error.
S403: and (6) initiating a transaction.
S404: a log database table is declared in the application.
S405: an autonomous transaction is declared in an application.
Declaring an AUTONOMOUS TRANSACTION can be implemented by declaring a PRAGMA AUTONOMOUS _ TRANSACTION AUTONOMOUS TRANSACTION statement, in which a COMMIT needs to be lifted separately. The order that declares the autonomous transaction provided by ORACLE is used to declare the autonomous transaction and log database tables. The statement log database table is used for storing an error log.
S406: whether the program runs abnormally is detected.
If the program runs normally, the transaction is directly carried out without triggering autonomous transaction, a transaction result is generated, the main transaction submission is completed, and S412 is carried out. If the program runs abnormally, S407 is performed.
S407: and submitting the main transaction to complete the transaction.
S408: an error log is recorded using the autonomous transaction and the master transaction is suspended.
If a program is detected to be running abnormally, ORACLE autonomous transaction logging error log can be realized by using embedded PL/SQL. During the autonomous transaction, the primary transaction is suspended temporarily and it is necessary to wait until the autonomous transaction executes a COMMIT or ROLLBACK before resuming the execution of the primary transaction.
S409: updating the error log into the log database table.
Specifically, the pre-generated log sequence number and the log number can be written into a log table by using SQL through an autonomous transaction, and the error log is updated into the log database table. It should be noted that the autonomous transaction is an independent transaction that is started on the primary transaction separately, and in order to avoid mutual influence, the primary transaction is temporarily suspended during the autonomous transaction processing.
Autonomous transactions may commit or rollback independently of invoking a primary transaction, where consideration needs to be given to whether processing associated with the primary transaction is required based on the criticality of the autonomous transaction. Since the autonomous transaction is relatively critical and is not expected to be related to the transaction consistency of the primary transaction, the autonomous transaction is independent of the primary transaction, but needs to have a correlation relationship in the process.
S410: an autonomous transaction performs either a commit or a rollback.
In order to ensure the execution of a complete flow of the correct creation of a log database table, the correct declaration of an ORACLE autonomous transaction in a program, the normal triggering of the autonomous transaction and the like, a COMMIT operation is not submitted when the autonomous transaction is declared.
S411: and recovering the main transaction after the autonomous transaction is committed or rolled back, and returning to the step S407.
Based on the same inventive concept, the embodiment of the present application further provides a log processing apparatus, which can be used to implement the methods described in the foregoing embodiments, as described in the following embodiments. Because the principle of the log processing device for solving the problem is similar to the log processing method, the implementation of the log processing device can refer to the implementation of the log processing method, and repeated details are not repeated. As used hereinafter, the term "unit" or "module" may be a combination of software and/or hardware that implements a predetermined function. While the system described in the embodiments below is preferably implemented in software, implementations in hardware, or a combination of software and hardware are also possible and contemplated.
Fig. 5 is a block diagram of a log processing device according to an embodiment of the present application, and as shown in fig. 5, the log processing device includes: declaration unit 501, log recording unit 502, and log updating unit 503.
When an transaction is initiated, the declaration unit 501 is configured to declare an autonomous transaction and a log database table in a background application;
in particular, the declaration unit 501 may declare the log database table, which is used to record the error log, using the embedded PL/SQL autonomous transaction.
Declaring an AUTONOMOUS TRANSACTION can be implemented by declaring a PRAGMA AUTONOMOUS _ TRANSACTION AUTONOMOUS TRANSACTION statement, in which COMMIT needs to be lifted separately. The autonomous transaction is declared using the command to declare the autonomous transaction provided by ORACLE.
When the abnormal operation of the program is detected, the log recording unit 502 is used for recording an error log by using the autonomous transaction and suspending the main transaction;
if the program runs normally, the transaction is directly carried out without triggering the autonomous transaction, a transaction result is generated, and the main transaction submission is completed.
If a program is detected to be running abnormally, an ORACLE autonomous transaction logging error log can be implemented using embedded PL/SQL. During the autonomous transaction, the primary transaction is suspended temporarily and it is necessary to wait until the autonomous transaction executes a COMMIT or ROLLBACK before resuming the execution of the primary transaction.
Autonomous transactions may commit or rollback independently of invoking a primary transaction, where consideration needs to be given to whether processing associated with the primary transaction is required based on the criticality of the autonomous transaction. Since the autonomous transaction is relatively critical and does not want to be related to the transaction consistency of the primary transaction, the autonomous transaction is independent of the primary transaction, but needs to have a correlation relationship in the process.
The log updating unit 503 is configured to update the error log into the log database table, and recover the main transaction after the autonomous transaction is committed or rolled back.
In the log processing device provided by the application, when an transaction is initiated, a declaration unit 510 declares an autonomous transaction and a log database table in a background application program, and when the abnormal operation of the program is detected, a log recording unit 502 records an error log by using the autonomous transaction and suspends a main transaction; the log update unit 503 updates the error log into the log database table, and recovers the main transaction after the execution of the autonomous transaction commits or rolls back. By using the method, the application log recording function can be realized through the autonomous transaction, so that the recording of the error log is not influenced by the rollback of the main transaction, and the main program is not depended on or interfered.
In one embodiment, the log processing apparatus further includes: and the first log sequence number generation unit is used for creating a sequence, generating and storing the log sequence number of the transaction by using the sequence.
In another embodiment, the log processing apparatus further includes: and the second log sequence number generation unit is used for generating and storing the log sequence number in a mode of increasing the log database table date + the current date number.
In an embodiment, as shown in fig. 6, the logging unit 502 includes: a log number generation module 601 and an information writing module 602.
The log number generation module 601 is configured to generate a log number of a transaction by using an autonomous transaction, and write the log number into a corresponding error log, where each step of log of each transaction corresponds to one number;
the information writing module 602 is configured to write the log sequence number and the log number into a log table.
In one embodiment, as shown in fig. 7, the log updating unit 503 includes: an update module 701, a commit module 702, and a master event recovery module 703.
The updating module 701 is used for updating the error log into the log database table by using SQL through autonomous transaction;
it should be noted that the autonomous transaction is an independent transaction that is started on the primary transaction separately, and in order to avoid mutual influence, the primary transaction is temporarily suspended during the autonomous transaction processing.
Autonomous transactions may commit or rollback independently of invoking a primary transaction, where consideration needs to be given to whether processing associated with the primary transaction is required based on the criticality of the autonomous transaction. Since the autonomous transaction is relatively critical and is not expected to be related to the transaction consistency of the primary transaction, the autonomous transaction is independent of the primary transaction, but needs to have a correlation relationship in the process.
The submitting module 702 is configured to submit commit to the log database table from the autonomous transaction through an SQL update operation;
in order to ensure the execution of a whole set of flow such as the correct creation of a log database table, the correct declaration of an ORACLE autonomous transaction in a program, the normal triggering of the autonomous transaction and the like, the COMMIT operation is not submitted when the autonomous transaction is declared.
The master transaction recovery module 703 is used to recover the master transaction after the autonomous transaction performs commit or rollback.
In an embodiment, the autonomous transaction is declared in the background application, and the autonomous transaction may be declared by using a command for declaring the autonomous transaction provided by ORACLE, which is not limited in this application.
It should be noted that, the present application can process different error logs according to different requirements, and ensure independence of different dates and different numbers of strokes.
In an embodiment, the declaration unit 501 is specifically configured to: the autonomous transaction is declared using the command to declare the autonomous transaction provided by ORACLE.
The apparatuses, modules or units illustrated in the above embodiments may be specifically implemented by a computer chip or an entity, or implemented by a product with certain functions. A typical implementation device is a computer device, which may be, for example, a personal computer, a laptop computer, a cellular telephone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
In a typical example, the computer device comprises in particular a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the method performed by the client as described above when executing the program or the processor implementing the method performed by the server as described above when executing the program.
Referring now to FIG. 8, shown is a schematic diagram of a computer device 600 suitable for use in implementing embodiments of the present application.
As shown in fig. 8, the computer apparatus 600 includes a Central Processing Unit (CPU) 601 which can execute various appropriate jobs and processes according to a program stored in a Read Only Memory (ROM) 602 or a program loaded from a storage section 608 into a Random Access Memory (RAM) 603. In the RAM603, various programs and data necessary for the operation of the system 600 are also stored. The CPU601, ROM602, and RAM603 are connected to each other via a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
The following components are connected to the I/O interface 605: an input portion 606 including a keyboard, a mouse, and the like; an output portion 607 including a Cathode Ray Tube (CRT), a liquid crystal feedback (LCD), and the like, and a speaker and the like; a storage section 608 including a hard disk and the like; and a communication section 609 including a network interface card such as a LAN card, a modem, or the like. The communication section 609 performs communication processing via a network such as the internet. A driver 610 is also connected to the I/O interface 605 as needed. A removable medium 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 610 as necessary, so that a computer program read out therefrom is mounted as necessary on the storage section 608.
In particular, according to embodiments of the present application, the processes described above with reference to the flow diagrams may be implemented as computer software programs. For example, embodiments of the present application include a computer program product comprising a computer program tangibly embodied on a machine-readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 609, and/or installed from the removable medium 611.
Computer-readable media, including both permanent and non-permanent, removable and non-removable media, may implement the information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
For convenience of description, the above devices are described as being divided into various units by function, and are described separately. Of course, the functionality of the units may be implemented in one or more software and/or hardware when implementing the present application.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrases "comprising a," "8230," "8230," or "comprising" does not exclude the presence of other like elements in a process, method, article, or apparatus comprising the element.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and so forth) having computer-usable program code embodied therein.
The application may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The application may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, as for the system embodiment, since it is substantially similar to the method embodiment, the description is relatively simple, and reference may be made to the partial description of the method embodiment for relevant points.
The above description is only an example of the present application and is not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (14)

1. A log processing method, comprising:
declaring an autonomous transaction and a log database table in a background application program when the transaction is initiated;
when the abnormal operation of the program is detected, recording an error log by using the autonomous transaction, and suspending the main transaction;
and updating the error log into the log database table, and recovering the main transaction after the autonomous transaction is submitted or returned.
2. The log processing method according to claim 1, further comprising:
and creating a sequence, and generating and storing a log sequence number of the transaction by using the sequence.
3. The log processing method according to claim 1, further comprising:
and generating and storing the log sequence number in a mode of increasing the log database table date + the current date number.
4. A log processing method according to claim 2 or 3, wherein recording the error log using the autonomous transaction comprises:
generating a log number of a transaction by using an autonomous transaction, and writing the log number into a corresponding error log, wherein each step of log of each transaction corresponds to one number;
and writing the log serial number and the log number into a log table.
5. The log processing method of claim 1, wherein the updating the error log into the log database table and recovering the primary transaction after the autonomous transaction performs commit or rollback comprises:
updating an error log into the log database table by using SQL through an autonomous transaction;
committing commit to the log database table by the SQL updating operation autonomous transaction;
the primary transaction is resumed after the autonomous transaction performs commit or rollback.
6. The log processing method of claim 1, wherein declaring autonomous transactions in a background application comprises:
the autonomous transaction is declared using the command provided by ORACLE to declare the autonomous transaction.
7. A log processing apparatus, comprising:
the declaration unit is used for declaring the autonomous transaction and the log database table in a background application program when the transaction is initiated;
the log recording unit is used for recording an error log by using the autonomous transaction and suspending the main transaction when the abnormal operation of the program is detected;
and the log updating unit is used for updating the error log into the log database table and recovering the main transaction after the execution of the autonomous transaction is submitted or returned.
8. The log processing apparatus according to claim 7, further comprising:
and the first log sequence number generation unit is used for creating a sequence, generating and storing the log sequence number of the transaction by using the sequence.
9. The log processing apparatus according to claim 7, further comprising:
and the second log sequence number generation unit is used for generating and storing the log sequence number in a mode of increasing the date of the log database table and the current date number.
10. The log processing apparatus according to claim 8 or 9, wherein the log recording unit includes:
the log number generating module is used for generating a log number of the transaction by using the autonomous transaction and writing the log number into a corresponding error log, wherein each step of log of each transaction corresponds to one number;
and the information writing module is used for writing the log serial number and the log number into a log table.
11. The log processing apparatus according to claim 7, wherein the log updating unit includes:
the updating module is used for updating the error log into the log database table by using SQL through autonomous transactions;
the commit module is used for committing commit to the log database table through the SQL updating operation autonomous transaction;
and the main affair recovery module is used for recovering the main affair after the autonomous affair is submitted or returned.
12. The log processing apparatus of claim 7, wherein the declaration unit is specifically configured to: the autonomous transaction is declared using the command to declare the autonomous transaction provided by ORACLE.
13. A computer device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor,
the processor, when executing the program, implements the method of any of claims 1-6.
14. A computer-readable medium, having stored thereon a computer program,
the program when executed by a processor implementing the method of any one of claims 1 to 6.
CN202211216826.2A 2022-09-30 2022-09-30 Log processing method and device Pending CN115481094A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211216826.2A CN115481094A (en) 2022-09-30 2022-09-30 Log processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211216826.2A CN115481094A (en) 2022-09-30 2022-09-30 Log processing method and device

Publications (1)

Publication Number Publication Date
CN115481094A true CN115481094A (en) 2022-12-16

Family

ID=84393249

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211216826.2A Pending CN115481094A (en) 2022-09-30 2022-09-30 Log processing method and device

Country Status (1)

Country Link
CN (1) CN115481094A (en)

Similar Documents

Publication Publication Date Title
US10437795B2 (en) Upgrading systems with changing constraints
EP2657859B1 (en) Ensuring database log recovery consistency
US7992148B2 (en) Issuing syncpoints during execution of a batch application to minimize or eliminate periods of record unavailability due to batch related record locking
US8527462B1 (en) Database point-in-time restore and as-of query
EP1504346B1 (en) Method and apparatus for creating a virtual data copy
CN104937556A (en) Recovering pages of database
US20120158795A1 (en) Entity triggers for materialized view maintenance
EP2590078B1 (en) Shadow paging based log segment directory
JPH0628043B2 (en) How to restore the operation of a database system
CN107016016B (en) Data processing method and device
CN111274318B (en) Block chain state data storage and rollback method, equipment and storage medium
US6944635B2 (en) Method for file deletion and recovery against system failures in database management system
CN109086425B (en) Data processing method and device for database
CN105159991B (en) A kind of method, apparatus, system and application server keeping data consistency
CN111538519A (en) Version upgrading method and device
US9207966B2 (en) Method and system for providing a high-availability application
US7631020B1 (en) Method and system of generating a proxy for a database
CN106897345A (en) A kind of method and device of data storage
CN108647112B (en) Data backup method and device and distributed transaction processing system
US11100089B2 (en) Systems and methods for use in loading data based on a hierarchical framework
CN115481094A (en) Log processing method and device
CN115658391A (en) Backup recovery method of WAL mechanism based on QianBase MPP database
KR100365891B1 (en) Backup/recovery Apparatus and method for non-log processing of real-time main memory database system
CN112765126A (en) Database transaction management method and device, computer equipment and storage medium
JP3290182B2 (en) Data set backup method and apparatus in shared environment

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