CN107480009A - A kind of transaction recovery method and device - Google Patents
A kind of transaction recovery method and device Download PDFInfo
- Publication number
- CN107480009A CN107480009A CN201710712462.XA CN201710712462A CN107480009A CN 107480009 A CN107480009 A CN 107480009A CN 201710712462 A CN201710712462 A CN 201710712462A CN 107480009 A CN107480009 A CN 107480009A
- Authority
- CN
- China
- Prior art keywords
- log information
- affairs
- restored
- type
- sql
- 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
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/14—Error detection or correction of the data by redundancy in operation
- G06F11/1402—Saving, restoring, recovering or retrying
- G06F11/1474—Saving, restoring, recovering or retrying in transactions
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/14—Error detection or correction of the data by redundancy in operation
- G06F11/1402—Saving, restoring, recovering or retrying
- G06F11/1471—Saving, restoring, recovering or retrying involving logging of persistent data for recovery
-
- 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/23—Updating
- G06F16/2365—Ensuring data consistency and integrity
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2201/00—Indexing scheme relating to error detection, to error correction, and to monitoring
- G06F2201/80—Database-specific techniques
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Quality & Reliability (AREA)
- Computer Security & Cryptography (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The present invention provides a kind of transaction recovery method, determines pending log information;In pending log information, the information type of the log information with same transaction ID is obtained;In the log information with same transaction ID, when submitting the log information of type in the presence of preparation, and the log information for submitting successful types being not present, it is determined that the affairs corresponding with same transaction ID are affairs to be restored;Whole SQL statements included in the parsing log information corresponding with the affairs to be restored, and whole SQL statements are committed to target database.So as to, when application service middleware is restarted, pass through the processing to log information, it will have begun to submit when needing and restarting operation system and application service middleware but not submit successful this kind of affairs to be defined as affairs to be restored, and affairs to be restored are submitted automatically according to SQL statement corresponding in log information, reduce the repeated workload of business personnel, improve the efficiency of issued transaction.
Description
Technical field
The present invention relates to computer realm, more particularly to a kind of transaction recovery method and device.
Background technology
Application service middleware is under the application software, and network, operating system, the basic software on database are put down
Platform, for application provides name, affairs, safety, message, data access etc. service, and for apply provide exploitation, deployment, operation and
Manage back-up environment.Wherein, the concept of affairs originates from database technology, and it is a program execution unit, generally by one group
SQL (Structured Query Language, SQL) sentence forms.Affairs are performed as an entirety,
With inseparability, otherwise the SQL statement in affairs is performed entirely, otherwise do not perform entirely.
In the prior art, the content of business personnel's typing in the operation system on application service middleware, by industry
Business system is converted to affairs.When business personnel submits, application service middleware starts to submit the affairs to database, until carrying
Hand over successfully.However, when operation system chance failure occurs, it is necessary to when restarting operation system and application service middleware, not yet carry
Hand over successful affairs to be interrupted, processing can only be re-started.
For above-mentioned in the case of, business personnel needs to re-type and submit the affairs being interrupted, and this undoubtedly adds industry
The repeated workload of business personnel, reduce the efficiency of issued transaction.
The content of the invention
In view of this, the present invention provides a kind of transaction recovery method and device, for eligible in the affairs that are interrupted
Affairs recovered automatically, to reduce the repeated workload of business personnel, improve the efficiency of issued transaction.Technical scheme is such as
Under:
In a first aspect, this application provides a kind of transaction recovery method, including:
Determine pending log information;
In the pending log information, the information type of the log information with same transaction ID is obtained, wherein,
Described information type includes:SQL SQL statement type, prepare to submit type and submit successful types, and it is described
It is one-to-one relationship between affairs ID and affairs;
Described with same transaction ID log information, when the log information for preparing to submit type being present, and
In the absence of it is described submission successful types log information when, it is determined that the affairs corresponding with the same transaction ID are thing to be restored
Business;
Whole SQL statements included in the parsing log information corresponding with the affairs to be restored, and will be described complete
Portion's SQL statement is committed to target database, wherein, the target database is the data corresponding with the affairs to be restored
Storehouse.
Alternatively, methods described also includes:
After whole SQL statements are submitted successfully, added in the log information corresponding with the affairs to be restored
Processed mark, the processed mark show that the affairs to be restored were successfully restored.
Alternatively, the pending log information of the determination, including:
Determine target journaling file, the journal file that the target journaling file ultimately produces for cut-off current time;
In the target journaling file, it is determined that the log information not comprising the processed mark is described pending
Log information.
Alternatively, whole SQL statements included in the parsing log information corresponding with the affairs to be restored,
And whole SQL statements are committed to target database, including:
Parse whole SQL statements one by one by preset order, and whole SQL statements after parsing are sent to institute
State target database;
When whole SQL statements are sent, are sent to the target database and submit instruction.
Alternatively, before the pending log information step of the determination, in addition to:
For each affairs, before each SQL statement in caching affairs, generation is corresponding with the SQL statement
, the log information of the SQL statement type;
After the instruction for submitting the SQL statement is received, and before submitting the SQL statement to database, institute is generated
State the log information for preparing to submit type;
After submitting successfully, the log information for submitting successful types is generated.
Second aspect, present invention also provides a kind of transaction recovery device, including:
First determining unit, for determining pending log information;
Acquiring unit, in the pending log information, obtaining the log information with same transaction ID
Information type, wherein, described information type includes:SQL SQL statement type, prepare submit type and submit into
Work(type, and be one-to-one relationship between the affairs ID and affairs;
Second determining unit, for, with same transaction ID log information, being submitted described when the preparation be present
The log information of type, and in the absence of it is described submission successful types log information when, it is determined that relative with the same transaction ID
The affairs answered are affairs to be restored;
Recovery unit, for parsing whole SQL languages included in the log information corresponding with the affairs to be restored
Sentence, and whole SQL statements are committed to target database, wherein, the target database is and the affairs to be restored
Corresponding database.
Alternatively, described device also includes:
Indexing unit, for after whole SQL statements are submitted successfully, in the day corresponding with the affairs to be restored
Processed mark is added in will information, the processed mark shows that the affairs to be restored were successfully restored.
Alternatively, first determining unit includes:
First determination subelement, for determining target journaling file, the target journaling file is to end current time most
The journal file generated afterwards;
Second determination subelement, in the target journaling file, it is determined that the day not comprising the processed mark
Will information is the pending log information.
Alternatively, the recovery unit includes:
Transmission sub-unit, for parsing whole SQL statements one by one by preset order, and by the whole after parsing
SQL statement is sent to the target database;
Subelement is submitted, for when whole SQL statements are sent, sending submission to the target database and referring to
Order.
Alternatively, in addition to:
First daily record generation unit, for for each affairs, before each SQL statement in caching affairs, life
Into, the log information of the SQL statement type corresponding with the SQL statement;
Second daily record generation unit, for submitting institute after the instruction for submitting the SQL statement is received, and to database
Before stating SQL statement, the log information for preparing to submit type is generated;
3rd daily record generation unit, for after submitting successfully, generating the log information for submitting successful types.
The invention provides a kind of transaction recovery method, pending log information is determined;In the pending daily record
In information, the information type of the log information with same transaction ID is obtained, wherein, described information type includes:Structuring is looked into
Language SQL statement type is ask, prepares to submit type and submits successful types, and is to correspond between the affairs ID and affairs
Relation;Described with same transaction ID log information, the log information of type is submitted when the preparation be present, and do not deposit
In the log information of the submission successful types, it is determined that the affairs corresponding with the same transaction ID are affairs to be restored;
Whole SQL statements included in the parsing log information corresponding with the affairs to be restored, and by whole SQL statements
Target database is committed to, wherein, the target database is the database corresponding with the affairs to be restored.So as to,
When application service middleware is restarted, by the processing to log information, chance failure will occur in operation system, it is necessary to restart industry
Have begun to submit when business system and application service middleware but do not submit successful this kind of affairs to be defined as affairs to be restored, and
Affairs to be restored are submitted automatically according to SQL statement corresponding in log information, can make business personnel to this kind of affairs to be restored
It need not re-type and submit, reduce the repeated workload of business personnel, improve the efficiency of issued transaction.
Certainly, any product for implementing the present invention it is not absolutely required to reach all the above advantage simultaneously.
Brief description of the drawings
In order to illustrate more clearly about the embodiment of the present invention or technical scheme of the prior art, below will be to embodiment or existing
There is the required accompanying drawing used in technology description to be briefly described, it should be apparent that, drawings in the following description are only this
The embodiment of invention, for those of ordinary skill in the art, on the premise of not paying creative work, can also basis
The accompanying drawing of offer obtains other accompanying drawings.
Fig. 1 is a kind of flow chart of transaction recovery method provided by the invention;
Fig. 2 is the flow chart of another transaction recovery method provided by the invention;
Fig. 3 is the flow chart of another transaction recovery method provided by the invention;
Fig. 4 is the flow chart of another transaction recovery method provided by the invention;
Fig. 5 is the flow chart of another transaction recovery method provided by the invention;
Fig. 6 is a kind of structural representation of transaction recovery device provided by the invention;
Fig. 7 is the structural representation of another transaction recovery device provided by the invention;
Fig. 8 is the structural representation of another transaction recovery device provided by the invention;
Fig. 9 is the structural representation of another transaction recovery device provided by the invention;
Figure 10 is the structural representation of another transaction recovery device provided by the invention.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is carried out clear, complete
Site preparation describes, it is clear that described embodiment is only part of the embodiment of the present invention, rather than whole embodiments.It is based on
Embodiment in the present invention, those of ordinary skill in the art are obtained every other under the premise of creative work is not made
Embodiment, belong to the scope of protection of the invention.
Transaction recovery method provided by the present invention and transaction recovery device, applied to application service middleware.Using clothes
Business middleware is generally configurable in numerous general or special purpose computing devices.Wherein, application service middleware can be
WebLogic, Jboss etc..
Embodiment one
Fig. 1 is referred to, a kind of flow chart of transaction recovery method provided by the invention is shown, as shown in figure 1, this method
Including:
Step S11:Determine pending log information;
In the present embodiment, there is chance failure in operation system, and operation system and application service middleware need to restart, this
In the case of, it is necessary to carry out transaction recovery when restarting by application service middleware.Transaction recovery is firstly the need of in the day preserved
In will information, pending log information is determined.Pending log information is the basis of whole transaction recovery work.
Step S12:In the pending log information, the info class of the log information with same transaction ID is obtained
Type, wherein, described information type includes:SQL SQL statement type, prepare to submit type and submit successfully class
Type, and be one-to-one relationship between the affairs ID and affairs;
In the present embodiment, affairs are made up of SQL statement.For the operation system processing thereon of application service middleware
Affairs, each affairs have a unique corresponding affairs ID.For the log information corresponding with any one affairs, wherein
Affairs ID is included, for marking the affairs corresponding to log information.
In this step, the information type of the log information with same transaction ID is obtained, that is to say, that for pending
Log information, distinguished according to affairs ID.Then, for the log information with same transaction ID, log information is obtained
Information type.The information type of log information is divided into three classes:SQL statement type, prepare to submit type and submit successful types.
Wherein, a SQL statement is recorded in the log information of each SQL statement type;Prepare the log information table of submission type
Bright affairs are complete, have been enter into presentation stage;The log information of successful types is submitted to show that affairs have been successfully committed to number
According to storehouse.
Step S13:Described with same transaction ID log information, when the daily record for preparing to submit type being present
Information, and in the absence of it is described submission successful types log information when, it is determined that the affairs corresponding with the same transaction ID are
Affairs to be restored;
In the present embodiment, for any one group of log information pending, with same transaction ID, preparation be present and submit
The log information of type show the SQL statements of affairs corresponding with same transaction ID complete documentation in SQL statement type
In log information, show that the affairs are not successfully committed to database in the absence of the log information of submission successful types, that is,
Say, the affairs start submit after, submit successfully before be interrupted.Because the affairs have completely been recorded in log information
In, therefore, the affairs are affairs to be restored, can be recovered automatically.
Step S14:Whole SQL statements included in the parsing log information corresponding with the affairs to be restored, and
Whole SQL statements are committed to target database, wherein, the target database is corresponding with the affairs to be restored
Database.
In the present embodiment, for any one affairs to be restored, determined in the log information preserved to be restored with this
Log information corresponding the affairs ID of affairs, and whole SQL statements included in these log informations are parsed, and will parsing
The whole SQL statements gone out are committed to target database.
It should be noted that based on " submitting the log information of type when the preparation be present, and not depositing in step S13
In the log information of the submission successful types " fixed condition really, for any one affairs to be restored, in pending day
In will information, the log information of SQL statement type corresponding with the affairs to be restored, whole may can't be included.Due to
Log information records in chronological order, therefore in this case it is necessary to since pending log information, temporally
Inverted order, the log information of first SQL statement type of the affairs to be restored is navigated in the log information preserved, then
Temporally positive sequence, from this log information start to process.Wherein, the foundation of positioning starts to identify for affairs, specifically, can
Be added wherein when generating the log information of first SQL statement type of a certain affairs start mark or
When creating affairs, that is, generate one and include affairs initial statement (such as " begin "), SQL statement type log information, should
Initial statement can be used as starting to identify.
It should also be noted that, because database may be one, it is also possible to it is multiple, therefore in the day preserved
In will information, database connection ID is also included in each log information, for showing database corresponding to office.
The transaction recovery method that the present embodiment provides, determines pending log information;In the pending daily record letter
In breath, the information type of the log information with same transaction ID is obtained, wherein, described information type includes:Structuralized query
Language SQL statement type, prepare to submit type and submit successful types, and closed between the affairs ID and affairs to correspond
System;Described with same transaction ID log information, the log information of type is submitted when the preparation be present, and be not present
During the log information of the submission successful types, it is determined that the affairs corresponding with the same transaction ID are affairs to be restored;Solution
Whole SQL statements included in the analysis log information corresponding with the affairs to be restored, and whole SQL statements are carried
Hand over to target database, wherein, the target database is the database corresponding with the affairs to be restored.So as to answer
When being restarted with service middleware, by the processing to log information, chance failure will occur in operation system, it is necessary to restart business
Have begun to submit when system and application service middleware but do not submit successful this kind of affairs to be defined as affairs to be restored, and according to
Submit affairs to be restored automatically according to SQL statement corresponding in log information, can make business personnel to this kind of affairs to be restored without
It need to re-type and submit, reduce the repeated workload of business personnel, improve the efficiency of issued transaction.
Embodiment two
On the basis of embodiment one, Fig. 2 is referred to, is the flow of another transaction recovery method provided by the invention
Figure, as shown in Fig. 2 after step s 14, can also include:
Step S15:After whole SQL statements are submitted successfully, believe in the daily record corresponding with the affairs to be restored
Processed mark is added in breath, the processed mark shows that the affairs to be restored were successfully restored.
In the present embodiment, processed mark is added in the log information corresponding with affairs to be restored, it is extensive to show that this is treated
Multiple affairs are successfully restored.In step s 11, when obtaining pending log information processed mark will can not be included
As a condition.
On the basis of Fig. 2, Fig. 3 is referred to, shows the flow chart of another transaction recovery method provided by the invention,
As shown in figure 3, determine that pending log information can include in step S11:
Step S21:Determine target journaling file, the daily record that the target journaling file ultimately produces for cut-off current time
File;
In the present embodiment, log information is stored in journal file, often by a fixed cycle, then generates a daily record
File, fixed cycle can be 0.5 hour, 1 hour etc..By taking 1 hour fixed cycle as an example, journal file title can define
For yyyymmddhh.log, wherein, yyyy:Current year;mm:Current month;dd:Work as the day before yesterday;hh:Current hour is (small by 24
When calculate).
The journal file that target journaling file ultimately produces for cut-off current time, it is contemplated that some special circumstances,
Such as, by taking 1 hour fixed cycle as an example, when application service middleware is restarted, target journaling file just generates, or only saves
The log information of a few minutes.In this case, the effect of transaction recovery is obviously lowered.It is preferred, therefore, that it is determined that target
During journal file, if generation time of journal file that cut-off current time ultimately produces is less than a threshold value (e.g., for solid
Fixed cycle 1 hour can be 10 minutes or 15 minutes, or 1/5 or 1/6, etc. using the fixed cycle), then will be with the daily record
The journal file of adjacent, the last generation of file is defined as target journaling file simultaneously, comprehensive in transaction recovery to realize
With efficiently take into account.
Step S22:In the target journaling file, it is determined that the log information not comprising the processed mark is described
Pending log information.
, it is necessary to which application service middleware repeated priming problem in view of being possible to occur, this is possible in the present embodiment
Affairs to be restored are caused repeatedly to be committed to database, therefore, it is determined that excluding comprising processed during pending log information
The log information of mark, avoid repeating the appearance of submission situation.It is also possible to reduce the automatic work recovered in business process
Amount, the efficiency of transaction recovery is improved to a certain extent.
Preferably, can be right in application service middleware normal operation in order to further improve the efficiency of transaction recovery
In submitting log information corresponding to successful office under normal circumstances, normal termination mark is added wherein, it is determined that waiting to locate
The log information identified comprising normal termination is excluded in the lump during the log information of reason.
Embodiment three
4 are referred to, is the flow chart of another transaction recovery method provided by the invention, as shown in figure 4, step S14 can
With including:
Step S31:Parse whole SQL statements one by one by preset order, and by whole SQL statements after parsing
Send to the target database;
, can be with for whole SQL statements included in the log information corresponding with affairs to be restored in the present embodiment
The mode for parsing a SQL statement in order then to target database transmission once is taken, SQL statement can also all be parsed
It is cached in internal memory, last time sends whole SQL statements to the mode of target database in order.
Step S32:When whole SQL statements are sent, are sent to the target database and submit instruction.
In the present embodiment, it is " commit " instruction to submit instruction, after submitting instruction to be sent to database, you can think thing
Business has been successfully committed.Ensure atomicity, uniformity, isolation, the persistence of affairs by the mechanism of database in itself afterwards.
Example IV
Fig. 5 is referred to, is the flow chart of another transaction recovery method provided by the invention, as shown in figure 5, this method bag
Include:
Step S41:For each affairs, before each SQL statement in caching affairs, generation and the SQL languages
Corresponding, the log information of the SQL statement type of sentence;
In the present embodiment, the content of business personnel's typing in the operation system on application service middleware, by business
System is converted to affairs, that is, is converted into a series of SQL statement, and then SQL statement is cached in internal memory, waits to be committed.
Before SQL statement is cached, the log information of SQL statement type is generated.The form of the log information of SQL statement type can be:
Apply Names | affairs ID | SQL statement | database connection ID, such as " project A | 13 | insert into B values
(C, ' D ') | 2 ", wherein, Apply Names is that " project A ", affairs ID are " 13 ", and SQL statement is " insert into B
Values (C, ' D ') ", database connection ID is " 2 " (can be understood as 2 number storehouses).
Step S42:After the instruction for submitting the SQL statement is received, and to database submit the SQL statement it
Before, generate the log information for preparing to submit type;
In the present embodiment, application service middleware receive business personnel send submit affairs (namely whole SQL languages
Sentence) instruction after, generation prepare submit type log information, then start to database submit affairs.Prepare to submit type
The form of log information can be:Apply Names | affairs ID | ready-commit | database connection ID, such as " project
A | 13 | ready-commit | 2 ", " ready-commit " represents to prepare to submit.
Step S43:After submitting successfully, the log information for submitting successful types is generated;
In the present embodiment, after affairs (namely whole SQL statements) are submitted successfully, the day of the submission successful types of record
The form of will information can be:Apply Names | affairs ID | commit | database connection ID, such as " project A | 13 |
Commit | 2 ", " commit " represents to submit successfully.
Step S44:Determine pending log information;
In the present embodiment, when application service middleware restarts, that is, recovery flow is initially entered.
Step S45:In the pending log information, the info class of the log information with same transaction ID is obtained
Type, wherein, described information type includes:SQL SQL statement type, prepare to submit type and submit successfully class
Type, and be one-to-one relationship between the affairs ID and affairs;
Step S46:Described with same transaction ID log information, when the daily record for preparing to submit type being present
Information, and in the absence of it is described submission successful types log information when, it is determined that the affairs corresponding with the same transaction ID are
Affairs to be restored;
Step S47:Whole SQL statements included in the parsing log information corresponding with the affairs to be restored, and
Whole SQL statements are committed to target database, wherein, the target database is corresponding with the affairs to be restored
Database.
Embodiment five
Fig. 6 is referred to, is a kind of structural representation of transaction recovery device provided by the invention, as shown in fig. 6, the device
Including:
First determining unit 51, for determining pending log information;
Acquiring unit 52, in the pending log information, obtaining the log information with same transaction ID
Information type, wherein, described information type includes:SQL SQL statement type, prepare to submit type and submission
Successful types, and be one-to-one relationship between the affairs ID and affairs;
Second determining unit 53, for, with same transaction ID log information, being carried described when the preparation be present
Hand over type log information, and in the absence of it is described submission successful types log information when, it is determined that with the same transaction ID phases
Corresponding affairs are affairs to be restored;
Recovery unit 54, for parsing whole SQL included in the log information corresponding with the affairs to be restored
Sentence, and whole SQL statements are committed to target database, wherein, the target database is and the thing to be restored
It is engaged in corresponding database.
In one embodiment of the application, as shown in fig. 7, can also include on the basis of embodiment illustrated in fig. 6:
Indexing unit 55, for after whole SQL statements are submitted successfully, corresponding with the affairs to be restored
Processed mark is added in log information, the processed mark shows that the affairs to be restored were successfully restored.
In one embodiment of the application, as shown in figure 8, the first determining unit 51 can include:
First determination subelement 511, for determining target journaling file, the target journaling file is cut-off current time
The journal file ultimately produced;
Second determination subelement 512, in the target journaling file, it is determined that not comprising the processed mark
Log information is the pending log information.
In one embodiment of the application, as shown in figure 9, recovery unit 54 can include:
Transmission sub-unit 541, for parsing whole SQL statements one by one by preset order, and by described in after parsing
Whole SQL statements are sent to the target database;
Subelement 542 is submitted, for when whole SQL statements are sent, sending and carrying to the target database
Interdigital order.
In another embodiment of the application, as shown in Figure 10, on the basis of embodiment illustrated in fig. 6, it can also include:
First daily record generation unit 56, for for each affairs, before each SQL statement in caching affairs,
Generate, the log information of the SQL statement type corresponding with the SQL statement;
Second daily record generation unit 57, for being submitted after the instruction for submitting the SQL statement is received, and to database
Before the SQL statement, the log information for preparing to submit type is generated;
3rd daily record generation unit 58, for after submitting successfully, generating the log information for submitting successful types.
It should be noted that each embodiment in this specification is described by the way of progressive, each embodiment weight
Point explanation is all difference with other embodiment, between each embodiment identical similar part mutually referring to.
For device class embodiment, because it is substantially similar to embodiment of the method, so description is fairly simple, related part is joined
See the part explanation of embodiment of the method.
Finally, it is to be noted that, herein, such as first and second or the like relational terms be used merely to by
One entity or operation make a distinction with another entity or operation, and not necessarily require or imply these entities or operation
Between any this actual relation or order be present.Moreover, term " comprising ", "comprising" or its any other variant meaning
Covering including for nonexcludability, so that process, method, article or equipment including a series of elements not only include that
A little key elements, but also the other element including being not expressly set out, or also include for this process, method, article or
The intrinsic key element of equipment.In the absence of more restrictions, the key element limited by sentence "including a ...", is not arranged
Except other identical element in the process including the key element, method, article or equipment being also present.
For convenience of description, it is divided into various units during description apparatus above with function to describe respectively.Certainly, this is being implemented
The function of each unit can be realized in same or multiple softwares and/or hardware during invention.
As seen through the above description of the embodiments, those skilled in the art can be understood that the present invention can
Realized by the mode of software plus required general hardware platform.Based on such understanding, technical scheme essence
On the part that is contributed in other words to prior art can be embodied in the form of software product, the computer software product
It can be stored in storage medium, such as ROM/RAM, magnetic disc, CD, including some instructions are causing a computer equipment
(can be personal computer, server, either network equipment etc.) performs some of each embodiment of the present invention or embodiment
Method described in part.
Technical scheme provided by the present invention is described in detail above, specific case used herein is to this hair
Bright principle and embodiment is set forth, the explanation of above example be only intended to help the method for understanding the present invention and its
Core concept;Meanwhile for those of ordinary skill in the art, according to the thought of the present invention, in embodiment and application
There will be changes in scope, in summary, this specification content should not be construed as limiting the invention.
Claims (10)
- A kind of 1. transaction recovery method, it is characterised in that including:Determine pending log information;In the pending log information, the information type of the log information with same transaction ID is obtained, wherein, it is described Information type includes:SQL SQL statement type, prepare to submit type and submit successful types, and the affairs It is one-to-one relationship between ID and affairs;Described with same transaction ID log information, the log information of type is submitted when the preparation be present, and do not deposit In the log information of the submission successful types, it is determined that the affairs corresponding with the same transaction ID are affairs to be restored;Whole SQL statements included in the parsing log information corresponding with the affairs to be restored, and by whole SQL Sentence is committed to target database, wherein, the target database is the database corresponding with the affairs to be restored.
- 2. according to the method for claim 1, it is characterised in that also include:After whole SQL statements are submitted successfully, add and located in the log information corresponding with the affairs to be restored Reason mark, the processed mark show that the affairs to be restored were successfully restored.
- 3. according to the method for claim 2, it is characterised in that the pending log information of the determination, including:Determine target journaling file, the journal file that the target journaling file ultimately produces for cut-off current time;In the target journaling file, it is determined that the log information not comprising the processed mark is the pending daily record Information.
- 4. according to the method for claim 1, it is characterised in that the parsing daily record corresponding with the affairs to be restored Whole SQL statements included in information, and whole SQL statements are committed to target database, including:Parse whole SQL statements one by one by preset order, and whole SQL statements after parsing are sent to the mesh Mark database;When whole SQL statements are sent, are sent to the target database and submit instruction.
- 5. according to the method for claim 1, it is characterised in that before the pending log information step of the determination, Also include:For each affairs, before each SQL statement in caching affairs, institute corresponding with the SQL statement is generated State the log information of SQL statement type;After the instruction for submitting the SQL statement is received, and before submitting the SQL statement to database, the standard is generated The standby log information for submitting type;After submitting successfully, the log information for submitting successful types is generated.
- A kind of 6. transaction recovery device, it is characterised in that including:First determining unit, for determining pending log information;Acquiring unit, in the pending log information, obtaining the information of the log information with same transaction ID Type, wherein, described information type includes:SQL SQL statement type, prepare to submit type and submit successfully class Type, and be one-to-one relationship between the affairs ID and affairs;Second determining unit, for, with same transaction ID log information, type being submitted when the preparation be present described Log information, and in the absence of it is described submission successful types log information when, it is determined that corresponding with the same transaction ID Affairs are affairs to be restored;Recovery unit, for parsing whole SQL statements included in the log information corresponding with the affairs to be restored, and Whole SQL statements are committed to target database, wherein, the target database is corresponding with the affairs to be restored Database.
- 7. device according to claim 6, it is characterised in that also include:Indexing unit, for after whole SQL statements are submitted successfully, believing in the daily record corresponding with the affairs to be restored Processed mark is added in breath, the processed mark shows that the affairs to be restored were successfully restored.
- 8. device according to claim 7, it is characterised in that first determining unit includes:First determination subelement, for determining target journaling file, the target journaling file is finally given birth to for cut-off current time Into journal file;Second determination subelement, in the target journaling file, it is determined that the daily record letter not comprising the processed mark Cease for the pending log information.
- 9. device according to claim 6, it is characterised in that the recovery unit includes:Transmission sub-unit, for parsing whole SQL statements one by one by preset order, and by whole SQL after parsing Sentence is sent to the target database;Subelement is submitted, for when whole SQL statements are sent, being sent to the target database and submitting instruction.
- 10. device according to claim 6, it is characterised in that also include:First daily record generation unit, for for each affairs, before each SQL statement in caching affairs, generation with The SQL statement is corresponding, the log information of the SQL statement type;Second daily record generation unit, for after the instruction for submitting the SQL statement is received, and described in submitting to database Before SQL statement, the log information for preparing to submit type is generated;3rd daily record generation unit, for after submitting successfully, generating the log information for submitting successful types.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710712462.XA CN107480009A (en) | 2017-08-18 | 2017-08-18 | A kind of transaction recovery method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710712462.XA CN107480009A (en) | 2017-08-18 | 2017-08-18 | A kind of transaction recovery method and device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN107480009A true CN107480009A (en) | 2017-12-15 |
Family
ID=60601780
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710712462.XA Pending CN107480009A (en) | 2017-08-18 | 2017-08-18 | A kind of transaction recovery method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107480009A (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110019077A (en) * | 2018-08-21 | 2019-07-16 | 平安科技(深圳)有限公司 | Log inquiring method, device, equipment and computer readable storage medium |
CN111241125A (en) * | 2020-01-08 | 2020-06-05 | 成都嗨学洛子教育科技有限公司 | Method and device for recording operation log, electronic equipment and storage medium |
CN111459720A (en) * | 2020-04-02 | 2020-07-28 | 上海新炬网络技术有限公司 | Mysql data recovery method based on transaction log |
CN111984625A (en) * | 2020-08-24 | 2020-11-24 | 北京人大金仓信息技术股份有限公司 | Database load characteristic processing method, device, medium and electronic equipment |
CN115905402A (en) * | 2022-09-26 | 2023-04-04 | 北京奥星贝斯科技有限公司 | Method and device for processing transaction log |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20050192962A1 (en) * | 2004-02-26 | 2005-09-01 | Patricia Furrer | Apparatus, system, method for enabling web-applications to access enterprise managed data |
CN101159003A (en) * | 2007-11-16 | 2008-04-09 | 中国科学院软件研究所 | Data-base malevolence transaction method and system thereof |
CN102891849A (en) * | 2012-09-25 | 2013-01-23 | 北京星网锐捷网络技术有限公司 | Service data synchronization method, data recovery method, data recovery device and network device |
CN103092903A (en) * | 2011-11-07 | 2013-05-08 | Sap股份公司 | Database Log Parallelization |
CN103345470A (en) * | 2013-05-31 | 2013-10-09 | 深圳市沃信科技有限公司 | Database disaster tolerance method, database disaster tolerance system and server |
CN104094227A (en) * | 2012-03-16 | 2014-10-08 | 甲骨文国际公司 | Systems and methods for supporting inline delegation of middle-tier transaction logs to database |
CN104516959A (en) * | 2014-12-18 | 2015-04-15 | 杭州华为数字技术有限公司 | Method and device for managing database logs |
CN105930500A (en) * | 2016-05-06 | 2016-09-07 | 华为技术有限公司 | Transaction recovery method in database system, and database management system |
-
2017
- 2017-08-18 CN CN201710712462.XA patent/CN107480009A/en active Pending
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20050192962A1 (en) * | 2004-02-26 | 2005-09-01 | Patricia Furrer | Apparatus, system, method for enabling web-applications to access enterprise managed data |
CN101159003A (en) * | 2007-11-16 | 2008-04-09 | 中国科学院软件研究所 | Data-base malevolence transaction method and system thereof |
CN103092903A (en) * | 2011-11-07 | 2013-05-08 | Sap股份公司 | Database Log Parallelization |
CN104094227A (en) * | 2012-03-16 | 2014-10-08 | 甲骨文国际公司 | Systems and methods for supporting inline delegation of middle-tier transaction logs to database |
CN104094227B (en) * | 2012-03-16 | 2018-05-22 | 甲骨文国际公司 | For supporting interlayer transaction journal to the system and method for the inline commission of database |
CN102891849A (en) * | 2012-09-25 | 2013-01-23 | 北京星网锐捷网络技术有限公司 | Service data synchronization method, data recovery method, data recovery device and network device |
CN103345470A (en) * | 2013-05-31 | 2013-10-09 | 深圳市沃信科技有限公司 | Database disaster tolerance method, database disaster tolerance system and server |
CN104516959A (en) * | 2014-12-18 | 2015-04-15 | 杭州华为数字技术有限公司 | Method and device for managing database logs |
CN105930500A (en) * | 2016-05-06 | 2016-09-07 | 华为技术有限公司 | Transaction recovery method in database system, and database management system |
Cited By (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110019077A (en) * | 2018-08-21 | 2019-07-16 | 平安科技(深圳)有限公司 | Log inquiring method, device, equipment and computer readable storage medium |
CN111241125A (en) * | 2020-01-08 | 2020-06-05 | 成都嗨学洛子教育科技有限公司 | Method and device for recording operation log, electronic equipment and storage medium |
CN111459720A (en) * | 2020-04-02 | 2020-07-28 | 上海新炬网络技术有限公司 | Mysql data recovery method based on transaction log |
CN111459720B (en) * | 2020-04-02 | 2023-07-07 | 上海新炬网络技术有限公司 | Mysql data recovery method based on transaction log |
CN111984625A (en) * | 2020-08-24 | 2020-11-24 | 北京人大金仓信息技术股份有限公司 | Database load characteristic processing method, device, medium and electronic equipment |
CN111984625B (en) * | 2020-08-24 | 2023-09-15 | 北京人大金仓信息技术股份有限公司 | Database load characteristic processing method and device, medium and electronic equipment |
CN115905402A (en) * | 2022-09-26 | 2023-04-04 | 北京奥星贝斯科技有限公司 | Method and device for processing transaction log |
CN115905402B (en) * | 2022-09-26 | 2023-07-18 | 北京奥星贝斯科技有限公司 | Method and device for processing transaction log |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107480009A (en) | A kind of transaction recovery method and device | |
CN107402963B (en) | Search data construction method, incremental data pushing device and equipment | |
US7668839B2 (en) | Application management for utilizing a replication engine of a Web-AP server to execute SIP replication | |
US20190163594A1 (en) | Using Cognitive Technologies to Identify and Resolve Issues in a Distributed Infrastructure | |
US20180113771A1 (en) | Transaction consistency query support for replicated data from recovery log to external data stores | |
CN109829011B (en) | Data synchronization method and device for distributed heterogeneous database | |
WO2017162032A1 (en) | Method and device for executing data recovery operation | |
US20120221605A1 (en) | Linking framework for information technology management | |
CN105930228A (en) | data backup method and system | |
US9659021B1 (en) | Client based backups and backup indexing | |
CN102317913A (en) | Transaction recovery method and apparatus | |
US9998544B2 (en) | Synchronization testing of active clustered servers | |
CN107168775A (en) | It is a kind of to hang the method and apparatus that affairs are automatically processed | |
WO2019118274A1 (en) | Automated transaction engine | |
CN104090896B (en) | A kind of methods, devices and systems that import data | |
CN106649000B (en) | Fault recovery method of real-time processing engine and corresponding server | |
CN106250501B (en) | Report processing method and reporting system | |
US9031969B2 (en) | Guaranteed in-flight SQL insert operation support during an RAC database failover | |
US10129328B2 (en) | Centralized management of webservice resources in an enterprise | |
CN102708143A (en) | Tracking redo completion at a page level | |
CN115757642A (en) | Data synchronization method and device based on filing log file | |
US8862544B2 (en) | Grid based replication | |
CN106934045B (en) | System and method for migration evaluation of database | |
US11442758B2 (en) | Integration flow execution renew | |
US10360234B2 (en) | Recursive extractor framework for forensics and electronic discovery |
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 | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20171215 |