CN115577031B - Database transaction processing method and device, electronic equipment and storage medium - Google Patents

Database transaction processing method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN115577031B
CN115577031B CN202211300898.5A CN202211300898A CN115577031B CN 115577031 B CN115577031 B CN 115577031B CN 202211300898 A CN202211300898 A CN 202211300898A CN 115577031 B CN115577031 B CN 115577031B
Authority
CN
China
Prior art keywords
completed
database transaction
interface priority
interface
target database
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202211300898.5A
Other languages
Chinese (zh)
Other versions
CN115577031A (en
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.)
Beijing Likong Yuantong Technology Co ltd
Original Assignee
Beijing Likong Yuantong Technology Co 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 Beijing Likong Yuantong Technology Co ltd filed Critical Beijing Likong Yuantong Technology Co ltd
Priority to CN202211300898.5A priority Critical patent/CN115577031B/en
Publication of CN115577031A publication Critical patent/CN115577031A/en
Application granted granted Critical
Publication of CN115577031B publication Critical patent/CN115577031B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • 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/25Integrating or interfacing systems involving database management systems
    • 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/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • 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
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

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

Abstract

The application provides a database transaction processing method, a device, electronic equipment and a storage medium, wherein the method comprises the following steps: acquiring operation execution results of a plurality of databases participating in target database transaction processing; when the operation execution result of any database is failure, detecting the interface priority of the failed operation and the interface priority of the completed operation; when the interface priority of the failed operation is lower than the interface priority of each completed operation, re-executing the failed operation, and at the moment, not carrying out data rollback on any database corresponding to the completed operation; and when all the operations contained in the target database transaction are completed, determining that the target database transaction is completed, and obtaining a processing result of the target database transaction. When the overall influence of the failed operation on the target database transaction is small, the data rollback is not carried out on the database corresponding to the completed operation, and the completed operation does not need to be repeatedly executed, so that the processing efficiency of the target database transaction is ensured.

Description

Database transaction processing method and device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of database technologies, and in particular, to a method and apparatus for processing database transactions, an electronic device, and a storage medium.
Background
At present, with the development of internet technology, the requirements of users on database services are higher and higher, so that the situation that one database service needs to be implemented by combining a plurality of databases often occurs, and the processing of database transactions is more and more complex.
In the prior art, in the case that one database transaction needs a plurality of database joint operation implementation, when the database operation of any database fails to be executed, data rollback is performed on all relevant databases, and the database transaction is re-executed.
However, when there are many related databases and database operations included in the database transaction are also many, if the database transaction is processed based on the prior art, a large number of related databases may perform multiple data rollbacks, which is not beneficial to ensuring the processing efficiency of the database transaction.
Disclosure of Invention
The application provides a database transaction processing method, a device, electronic equipment and a storage medium, which are used for solving the defects that the prior art is not beneficial to ensuring the processing efficiency of database transactions and the like.
A first aspect of the present application provides a database transaction processing method, including:
acquiring operation execution results of a plurality of databases participating in target database transaction processing;
when the operation execution result of any database is failure, detecting the interface priority of the failed operation and the interface priority of the completed operation; wherein the interface priority characterizes the extent of impact of a transaction operation on the target database transaction;
when the interface priority of the failed operation is lower than the interface priority of each completed operation, re-executing the failed operation, and at the moment, not carrying out data rollback on any database corresponding to the completed operation;
and when all operations contained in the target database transaction are completed, determining that the target database transaction is completed, and obtaining a processing result of the target database transaction.
Optionally, the method further comprises:
when the interface priority of the failed operation is higher than the interface priority of any completed operation, performing data rollback on a database corresponding to the completed operation;
the completed operation and the failed operation are repeatedly performed.
Optionally, the method further comprises:
judging whether the interface priority of the failed operation is higher than the interface priority of all the operations which are not executed;
and when the interface priority of the failed operation is higher than the interface priority of all the non-executed operations, suspending all the non-executed operations until the failed operation is completed to be repeatedly executed.
Optionally, the method further comprises:
and when the interface priority of the failed operation is lower than the interface priority of any one of the non-executed operations, normally executing the non-executed operation.
Optionally, before obtaining the execution result of the operation of the several databases participating in the target database transaction, the method further includes:
acquiring a service request of a user;
determining a target database transaction of the user according to the service request, and establishing interface connection with a plurality of databases participating in the target database transaction;
and calling service interfaces of the databases according to the operation content included in the target database transaction so as to execute corresponding transaction operations on the databases based on the service interfaces.
Optionally, the detecting the interface priority of the failed operation and the interface priority of the completed operation includes:
acquiring a service interface calling result corresponding to the failed operation and a service interface calling result corresponding to the completed operation;
and determining the interface priority of the failed operation and the interface priority of the completed operation according to the service interface calling result corresponding to the failed operation and the service interface calling result corresponding to the completed operation.
Optionally, the interfacing with a plurality of databases involved in the target database transaction includes:
acquiring connection information of a plurality of databases participating in target database transaction processing; wherein the connection information at least comprises a database name, a database IP and a database port;
and establishing interface connection with the databases according to the connection information.
A second aspect of the present application provides a database transaction processing apparatus, comprising:
the acquisition module is used for acquiring operation execution results of a plurality of databases participating in target database transaction processing;
the detection module is used for detecting the interface priority of failed operation and the interface priority of completed operation when the operation execution result of any database is failure; wherein the interface priority characterizes the extent of impact of a transaction operation on the target database transaction;
the processing module is used for re-executing the failure operation when the interface priority of the failure operation is lower than the interface priority of each completed operation, and at the moment, data rollback is not carried out on any database corresponding to the completed operation;
and the determining module is used for determining that the target database transaction is finished when all operations contained in the target database transaction are finished, and obtaining a processing result of the target database transaction.
Optionally, the processing module is further configured to:
when the interface priority of the failed operation is higher than the interface priority of any completed operation, performing data rollback on a database corresponding to the completed operation;
the completed operation and the failed operation are repeatedly performed.
Optionally, the processing module is further configured to:
judging whether the interface priority of the failed operation is higher than the interface priority of all the operations which are not executed;
and when the interface priority of the failed operation is higher than the interface priority of all the non-executed operations, suspending all the non-executed operations until the failed operation is completed to be repeatedly executed.
Optionally, the processing module is further configured to:
and when the interface priority of the failed operation is lower than the interface priority of any one of the non-executed operations, normally executing the non-executed operation.
Optionally, the acquiring module is further configured to:
acquiring a service request of a user;
determining a target database transaction of the user according to the service request, and establishing interface connection with a plurality of databases participating in the target database transaction;
and calling service interfaces of the databases according to the operation content included in the target database transaction so as to execute corresponding transaction operations on the databases based on the service interfaces.
Optionally, the detection module is specifically configured to:
acquiring a service interface calling result corresponding to the failed operation and a service interface calling result corresponding to the completed operation;
and determining the interface priority of the failed operation and the interface priority of the completed operation according to the service interface calling result corresponding to the failed operation and the service interface calling result corresponding to the completed operation.
Optionally, the acquiring module is specifically configured to:
acquiring connection information of a plurality of databases participating in target database transaction processing; wherein the connection information at least comprises a database name, a database IP and a database port;
and establishing interface connection with the databases according to the connection information.
A third aspect of the present application provides an electronic device, including: at least one processor and memory;
the memory stores computer-executable instructions;
the at least one processor executes the computer-executable instructions stored by the memory such that the at least one processor performs the method as described above in the first aspect and the various possible designs of the first aspect.
A fourth aspect of the present application provides a computer-readable storage medium having stored therein computer-executable instructions which, when executed by a processor, implement the method as described above in the first aspect and the various possible designs of the first aspect.
The technical scheme of the application has the following advantages:
the application provides a database transaction processing method, a device, electronic equipment and a storage medium, wherein the method comprises the following steps: acquiring operation execution results of a plurality of databases participating in target database transaction processing; when the operation execution result of any database is failure, detecting the interface priority of the failed operation and the interface priority of the completed operation; the interface priority characterizes the influence degree of the transaction operation on the target database transaction; when the interface priority of the failed operation is lower than the interface priority of each completed operation, re-executing the failed operation, and at the moment, not carrying out data rollback on any database corresponding to the completed operation; and when all the operations contained in the target database transaction are completed, determining that the target database transaction is completed, and obtaining a processing result of the target database transaction. According to the method provided by the scheme, under the condition that the interface priority of the failed operation is low, namely the overall influence of the failed operation on the target database transaction is small, the data rollback is not carried out on the database corresponding to the completed operation, and the completed operation does not need to be repeatedly executed, so that the processing efficiency of the target database transaction is ensured.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, a brief description will be given below of the drawings required for the embodiments or the description of the prior art, and it is obvious that the drawings in the following description are some embodiments of the present application, and other drawings may be obtained according to these drawings for a person having ordinary skill in the art.
FIG. 1 is a schematic diagram of a database transaction system according to an embodiment of the present application;
FIG. 2 is a flowchart of a database transaction method according to an embodiment of the present disclosure;
FIG. 3 is a schematic diagram of an exemplary database transaction system provided in an embodiment of the present application;
FIG. 4 is a schematic diagram of a database transaction processing device according to an embodiment of the present disclosure;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Specific embodiments thereof have been shown by way of example in the drawings and will herein be described in more detail. These drawings and the written description are not intended to limit the scope of the disclosed concepts in any way, but to illustrate the concepts of the present application to those skilled in the art with reference to the specific embodiments.
Detailed Description
For the purposes of making the objects, technical solutions and advantages of the embodiments of the present application more clear, the technical solutions of 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 apparent that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be made by one of ordinary skill in the art based on the embodiments herein without making any inventive effort, are intended to be within the scope of the present application.
Furthermore, the terms "first," "second," and the like, are used for descriptive purposes only and are not to be construed as indicating or implying a relative importance or implicitly indicating the number of technical features indicated. In the following description of the embodiments, the meaning of "a plurality" is two or more, unless explicitly defined otherwise.
In the prior art, in the case that one database transaction needs a plurality of database joint operation implementation, when the database operation of any database fails to be executed, data rollback is performed on all relevant databases, and the database transaction is re-executed. However, when there are many related databases and database operations included in the database transaction are also many, if the database transaction is processed based on the prior art, a large number of related databases may all perform multiple data rollbacks, which lacks flexibility in processing the database transaction, and is not beneficial to ensuring the processing efficiency of the database transaction.
In view of the foregoing, the method, apparatus, electronic device and storage medium for database transaction processing provided in the embodiments of the present application include: acquiring operation execution results of a plurality of databases participating in target database transaction processing; when the operation execution result of any database is failure, detecting the interface priority of the failed operation and the interface priority of the completed operation; the interface priority characterizes the influence degree of the transaction operation on the target database transaction; when the interface priority of the failed operation is lower than the interface priority of each completed operation, re-executing the failed operation, and at the moment, not carrying out data rollback on any database corresponding to the completed operation; and when all the operations contained in the target database transaction are completed, determining that the target database transaction is completed, and obtaining a processing result of the target database transaction. According to the method provided by the scheme, under the condition that the interface priority of the failed operation is low, namely the overall influence of the failed operation on the target database transaction is small, the data rollback is not carried out on the database corresponding to the completed operation, and the completed operation does not need to be repeatedly executed, so that the processing efficiency of the target database transaction is ensured.
The following embodiments may be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments. Embodiments of the present invention will be described below with reference to the accompanying drawings.
First, a description will be given of a structure of a database transaction processing system on which the present application is based:
the database transaction processing method, the device, the electronic equipment and the storage medium are suitable for processing database transactions involving joint operation of a plurality of databases. Fig. 1 is a schematic structural diagram of a database transaction processing system according to an embodiment of the present application, which mainly includes a data acquisition device, a plurality of databases, and a database transaction processing device. Specifically, the method can be based on the data acquisition device to acquire the operation execution results of each database in the execution process of the target database transaction, and send the obtained data to the database transaction processing device, and the device controls the specific execution flow of the target database transaction according to the obtained data.
The embodiment of the application provides a database transaction processing method which is used for processing database transactions involving a plurality of database joint operations. The execution body of the embodiment of the application is an electronic device, such as a server, a desktop computer, a notebook computer, a tablet computer and other electronic devices capable of processing database transactions.
As shown in fig. 2, a flowchart of a database transaction processing method according to an embodiment of the present application is shown, where the method includes:
step 201, obtaining operation execution results of a plurality of databases participating in the target database transaction.
Specifically, after any transaction operation in the target database transaction is executed, the execution result of the transaction operation is obtained in the database corresponding to the transaction operation, so as to determine whether the transaction operation is executed successfully.
Step 202, when the operation execution result of any database is failure, detecting the interface priority of the failed operation and the interface priority of the completed operation.
Wherein the interface priority characterizes a degree of impact of the transaction operation on the target database transaction.
It should be noted that, the target database transaction includes a plurality of transaction operations, each transaction operation is sequentially executed according to a preset sequence, and during the execution of the target database transaction, the transaction operations are at least classified into three types of completed operations, failed operations and unexecuted operations. In the process of processing the target database transaction, the transaction operation included in the target database transaction can be executed in parallel or in series.
And 203, when the interface priority of the failed operation is lower than the interface priority of each completed operation, re-executing the failed operation, and at this time, not performing data rollback on the database corresponding to any completed operation.
Specifically, when the interface priority of the failed operation is lower than the interface priority of each completed operation, it is determined that the failed operation has a smaller influence on the target database transaction, and whether the failed operation is successful or not has no influence on the execution of the completed operation, so that no data rollback is performed on the database corresponding to any completed operation at this time, that is, the completed operation does not need to be repeatedly executed, but only the failed operation is repeatedly executed until the execution is successful.
And 204, determining that the target database transaction is finished when all operations contained in the target database transaction are finished, and obtaining a processing result of the target database transaction.
Specifically, when all transaction operations in the target database transaction are completed operations, the completion processing of the target database transaction can be determined, and the processing result of the target database transaction can be obtained.
On the basis of the above embodiment, as a practical implementation, in an embodiment, the method further includes:
step 301, when the interface priority of the failed operation is higher than the interface priority of any completed operation, performing data rollback on the database corresponding to the completed operation;
step 302, the completed operation and the failed operation are repeatedly performed.
Specifically, when the interface priority of the failed operation is higher than the interface priority of any completed operation, the interface priority of the failed operation is higher, and the execution result of the failed operation has an effect on the execution of the completed operation, so that the database corresponding to the completed operation can be determined as the database to be rolled back, the corresponding data rolling back operation is performed, and after the data rolling back is completed, the completed operation and the failed operation are repeatedly executed.
Specifically, in an embodiment, to further improve the processing efficiency of the target database transaction, it may further be determined whether the interface priority of the failed operation is higher than the interface priority of all the non-executed operations; and when the interface priority of the failed operation is higher than the interface priority of all the non-executed operations, suspending all the non-executed operations until the failed operation is completed to be repeatedly executed.
Accordingly, in one embodiment, when the interface priority of the failed operation is lower than the interface priority of any non-executed operation, the non-executed operation is normally executed.
Specifically, when the interface priority of the failed operation is higher than the interface priorities of all the non-executed operations, it may be determined that the failed operation has a greater influence on the target database transaction, and the execution result of the failed operation may affect the non-executed operation that is about to be executed subsequently, so that all the non-executed operations are suspended, and after the failed operation completes the repeated execution, the non-executed operation is restarted.
Accordingly, when the interface priority of the failed operation is lower than the interface priority of any non-executed operation, it can be determined that the success or failure of the failed operation has no effect on the execution of the non-executed operation, so that the non-executed operation does not need to be suspended, and the non-executed operation can be normally executed.
On the basis of the foregoing embodiments, as a practical implementation manner, in one embodiment, before obtaining the execution results of the operations of the databases participating in the target database transaction, the method further includes:
step 401, obtaining a service request of a user;
step 402, determining a target database transaction of a user according to a service request, and establishing interface connection with a plurality of databases participating in the target database transaction;
step 403, according to the operation content included in the target database transaction, calling the service interfaces of the databases to execute corresponding transaction operations on the databases based on the service interfaces.
Exemplary, as shown in fig. 3, a schematic structural diagram of an exemplary database transaction processing system provided in an embodiment of the present application, where the method provided in the embodiment of the present application is applied to a background service and a custom transaction manager. The user sends a service request to a background service based on the client, the background service uniformly maintains a data table containing all database connection information, and when the background service receives the service request, the background service firstly determines a corresponding target database transaction and then establishes interface connection with a plurality of databases participating in the target database transaction according to the data table. And in the process of executing the target database transaction, according to the content of the currently executed transaction operation, calling a corresponding service interface for the transaction operation so as to perform transaction operations such as adding, deleting, checking and the like on the corresponding database. And each time a transaction operation is executed, feeding back an execution result of the transaction operation to the custom transaction manager, wherein the custom transaction manager judges whether to roll back data of a database corresponding to the completed operation based on the database transaction processing method provided by the embodiment, meanwhile judges whether to suspend processing of the unexecuted operation, and finally sends the judgment result to the background service, and the background service executes corresponding business operation according to the judgment result.
Specifically, in one embodiment, connection information of several databases participating in the target database transaction may be obtained; the connection information at least comprises a database name, a database IP and a database port; and establishing interface connection with a plurality of databases according to the connection information.
Specifically, the connection information may further include a database type, a database code, a database name, a user name, a current connection number of the database, a maximum allowable connection number of the database, a connection state, an addition time, a transaction operation type, and the like.
On the basis of the above embodiments, as an implementation manner, in an embodiment, detecting the interface priority of the failed operation and the interface priority of the completed operation includes:
step 2021, obtaining a service interface calling result corresponding to the failed operation and a service interface calling result corresponding to the completed operation;
step 2022, determining the interface priority of the failed operation and the interface priority of the completed operation according to the service interface call result corresponding to the failed operation and the service interface call result corresponding to the completed operation.
Specifically, the interface priority of each service interface may be preset before the target database transaction is executed, so that the interface priority corresponding to any transaction operation may be determined according to the service interface call result of the transaction operation.
The priority of the interface corresponding to each service interface may be set according to actual requirements, which is not limited in the embodiments of the present application.
According to the database transaction processing method, operation execution results of a plurality of databases participating in target database transaction processing are obtained; when the operation execution result of any database is failure, detecting the interface priority of the failed operation and the interface priority of the completed operation; the interface priority characterizes the influence degree of the transaction operation on the target database transaction; when the interface priority of the failed operation is lower than the interface priority of each completed operation, re-executing the failed operation, and at the moment, not carrying out data rollback on any database corresponding to the completed operation; and when all the operations contained in the target database transaction are completed, determining that the target database transaction is completed, and obtaining a processing result of the target database transaction. According to the method provided by the scheme, under the condition that the interface priority of the failed operation is low, namely the overall influence of the failed operation on the target database transaction is small, the data rollback is not carried out on the database corresponding to the completed operation, and the completed operation does not need to be repeatedly executed, so that the flexibility of the database transaction processing is improved, and the processing efficiency of the target database transaction is ensured.
The embodiment of the application provides a database transaction processing device, which is used for executing the database transaction processing method provided by the embodiment.
Fig. 4 is a schematic structural diagram of a database transaction processing device according to an embodiment of the present application. The database transaction processing device 40 includes: an acquisition module 401, a detection module 402, a processing module 403 and a determination module 404.
The acquisition module is used for acquiring operation execution results of a plurality of databases participating in target database transaction processing; the detection module is used for detecting the interface priority of failed operation and the interface priority of completed operation when the operation execution result of any database is failure; the interface priority characterizes the influence degree of the transaction operation on the target database transaction; the processing module is used for re-executing the failure operation when the interface priority of the failure operation is lower than the interface priority of each completed operation, and at the moment, data rollback is not carried out on a database corresponding to any completed operation; and the determining module is used for determining that the target database transaction is finished when all operations contained in the target database transaction are finished, and obtaining a processing result of the target database transaction.
Specifically, in an embodiment, the processing module is further configured to:
when the interface priority of the failed operation is higher than the interface priority of any completed operation, carrying out data rollback on the database corresponding to the completed operation;
the completed operation and the failed operation are repeatedly performed.
Specifically, in an embodiment, the processing module is further configured to:
judging whether the interface priority of the failed operation is higher than the interface priority of all the operations which are not executed;
and when the interface priority of the failed operation is higher than the interface priority of all the non-executed operations, suspending all the non-executed operations until the failed operation is completed to be repeatedly executed.
Specifically, in an embodiment, the processing module is further configured to:
when the interface priority of the failed operation is lower than the interface priority of any non-executed operation, the non-executed operation is normally executed.
Specifically, in an embodiment, the obtaining module is further configured to:
acquiring a service request of a user;
determining a target database transaction of a user according to the service request, and establishing interface connection with a plurality of databases participating in the target database transaction;
and calling service interfaces of the databases according to the operation content included in the target database transaction so as to execute corresponding transaction operations on the databases based on the service interfaces.
Specifically, in an embodiment, the detection module is specifically configured to:
acquiring a service interface calling result corresponding to the failed operation and a service interface calling result corresponding to the completed operation;
and determining the interface priority of the failed operation and the interface priority of the completed operation according to the service interface calling result corresponding to the failed operation and the service interface calling result corresponding to the completed operation.
Specifically, in an embodiment, the obtaining module is specifically configured to:
acquiring connection information of a plurality of databases participating in target database transaction processing; the connection information at least comprises a database name, a database IP and a database port;
and establishing interface connection with a plurality of databases according to the connection information.
The specific manner in which the respective modules perform the operations in the database transaction apparatus in this embodiment has been described in detail in relation to the embodiment of the method, and will not be described in detail here.
The database transaction processing device provided in the embodiment of the present application is configured to execute the database transaction processing method provided in the foregoing embodiment, and the implementation manner and principle of the method are the same and are not repeated.
The embodiment of the application provides an electronic device for executing the database transaction processing method provided by the embodiment.
Fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present application. The electronic device 50 includes: at least one processor 51 and a memory 52.
The memory stores computer-executable instructions; at least one processor executes the computer-executable instructions stored in the memory to cause the at least one processor to perform the database transaction method as provided in the above embodiments.
The implementation manner and principle of the electronic device provided in the embodiment of the present application are the same, and are not repeated.
The embodiment of the application provides a computer readable storage medium, wherein computer executable instructions are stored in the computer readable storage medium, and when a processor executes the computer executable instructions, the database transaction processing method provided by any embodiment is realized.
The storage medium including the computer executable instructions in the embodiments of the present application may be used to store the computer executable instructions of the database transaction processing method provided in the foregoing embodiments, and the implementation manner and principle of the implementation are the same, and are not repeated.
In the several embodiments provided in this application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of the units is merely a logical function division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in each embodiment of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in hardware plus software functional units.
The integrated units implemented in the form of software functional units described above may be stored in a computer readable storage medium. The software functional unit is stored in a storage medium, and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor (processor) to perform part of the steps of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-described division of the functional modules is illustrated, and in practical application, the above-described functional allocation may be performed by different functional modules according to needs, i.e. the internal structure of the apparatus is divided into different functional modules to perform all or part of the functions described above. The specific working process of the above-described device may refer to the corresponding process in the foregoing method embodiment, which is not described herein again.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some or all of the technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present application.

Claims (9)

1. A method of database transaction processing, comprising:
acquiring operation execution results of a plurality of databases participating in target database transaction processing;
when the operation execution result of any database is failure, detecting the interface priority of the failed operation and the interface priority of the completed operation; wherein the interface priority characterizes the extent of impact of a transaction operation on the target database transaction;
when the interface priority of the failed operation is lower than the interface priority of each completed operation, re-executing the failed operation, and at the moment, not carrying out data rollback on any database corresponding to the completed operation;
when all operations contained in the target database transaction are completed, determining that the target database transaction is completed, and obtaining a processing result of the target database transaction;
the method further comprises the steps of:
when the interface priority of the failed operation is higher than the interface priority of any completed operation, performing data rollback on a database corresponding to the completed operation;
the completed operation and the failed operation are repeatedly performed.
2. The method as recited in claim 1, further comprising:
judging whether the interface priority of the failed operation is higher than the interface priority of all the operations which are not executed;
and when the interface priority of the failed operation is higher than the interface priority of all the non-executed operations, suspending all the non-executed operations until the failed operation is completed to be repeatedly executed.
3. The method as recited in claim 2, further comprising:
and when the interface priority of the failed operation is lower than the interface priority of any one of the non-executed operations, normally executing the non-executed operation.
4. The method of claim 1, wherein prior to obtaining execution results of operations of a number of databases involved in the target database transaction, the method further comprises:
acquiring a service request of a user;
determining a target database transaction of the user according to the service request, and establishing interface connection with a plurality of databases participating in the target database transaction;
and calling service interfaces of the databases according to the operation content included in the target database transaction so as to execute corresponding transaction operations on the databases based on the service interfaces.
5. The method of claim 4, wherein detecting the interface priority of the failed operation and the interface priority of the completed operation comprises:
acquiring a service interface calling result corresponding to the failed operation and a service interface calling result corresponding to the completed operation;
and determining the interface priority of the failed operation and the interface priority of the completed operation according to the service interface calling result corresponding to the failed operation and the service interface calling result corresponding to the completed operation.
6. The method of claim 4, wherein interfacing with a plurality of databases involved in the target database transaction comprises:
acquiring connection information of a plurality of databases participating in target database transaction processing; wherein the connection information at least comprises a database name, a database IP and a database port;
and establishing interface connection with the databases according to the connection information.
7. A database transaction processing device, comprising:
the acquisition module is used for acquiring operation execution results of a plurality of databases participating in target database transaction processing;
the detection module is used for detecting the interface priority of failed operation and the interface priority of completed operation when the operation execution result of any database is failure; wherein the interface priority characterizes the extent of impact of a transaction operation on the target database transaction;
the processing module is used for re-executing the failure operation when the interface priority of the failure operation is lower than the interface priority of each completed operation, and at the moment, data rollback is not carried out on any database corresponding to the completed operation;
the determining module is used for determining that the target database transaction is finished when all operations contained in the target database transaction are finished, and obtaining a processing result of the target database transaction;
the processing module is further configured to:
when the interface priority of the failed operation is higher than the interface priority of any completed operation, performing data rollback on a database corresponding to the completed operation;
the completed operation and the failed operation are repeatedly performed.
8. An electronic device, comprising: at least one processor and memory;
the memory stores computer-executable instructions;
the at least one processor executing computer-executable instructions stored in the memory causes the at least one processor to perform the method of any one of claims 1 to 6.
9. A computer readable storage medium having stored therein computer executable instructions which when executed by a processor implement the method of any of claims 1 to 6.
CN202211300898.5A 2022-10-24 2022-10-24 Database transaction processing method and device, electronic equipment and storage medium Active CN115577031B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211300898.5A CN115577031B (en) 2022-10-24 2022-10-24 Database transaction processing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211300898.5A CN115577031B (en) 2022-10-24 2022-10-24 Database transaction processing method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN115577031A CN115577031A (en) 2023-01-06
CN115577031B true CN115577031B (en) 2023-07-25

Family

ID=84586087

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211300898.5A Active CN115577031B (en) 2022-10-24 2022-10-24 Database transaction processing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115577031B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107247784A (en) * 2017-06-14 2017-10-13 郑州云海信息技术有限公司 The control method and task manager of a kind of distributed transaction
CN110730958A (en) * 2017-06-09 2020-01-24 华为技术有限公司 Method and system for managing prioritized database transactions
CN113760924A (en) * 2020-10-28 2021-12-07 北京沃东天骏信息技术有限公司 Distributed transaction processing method and device

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7155429B2 (en) * 2002-07-09 2006-12-26 Bridgelogix Corporation Method, apparatus and article of manufacture to aggregate automated transaction procession
CN101667178B (en) * 2008-09-01 2012-08-22 北京数码大方科技有限公司 Transaction processing method used for C/S architecture file management system
US8880486B2 (en) * 2010-07-27 2014-11-04 Sap Ag Distributed database system utilizing an extended two-phase-commit process
CN104243438B (en) * 2013-06-24 2017-08-08 阿里巴巴集团控股有限公司 A kind of db transaction processing method and server
CN105893395B (en) * 2015-01-26 2019-04-02 阿里巴巴集团控股有限公司 The message of distributed transaction returns checking method and its system
US10303785B2 (en) * 2015-08-10 2019-05-28 International Business Machines Corporation Optimizing online schema processing for busy database objects
CN112231144A (en) * 2020-09-29 2021-01-15 上海艾融软件股份有限公司 Data processing method and device and electronic equipment
CN114253673A (en) * 2021-12-17 2022-03-29 中电金信软件有限公司 Transaction processing method and transaction processing device of distributed system
CN114356888A (en) * 2021-12-30 2022-04-15 中国民航信息网络股份有限公司 Transaction processing method and device, storage medium and electronic equipment

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110730958A (en) * 2017-06-09 2020-01-24 华为技术有限公司 Method and system for managing prioritized database transactions
CN107247784A (en) * 2017-06-14 2017-10-13 郑州云海信息技术有限公司 The control method and task manager of a kind of distributed transaction
CN113760924A (en) * 2020-10-28 2021-12-07 北京沃东天骏信息技术有限公司 Distributed transaction processing method and device

Also Published As

Publication number Publication date
CN115577031A (en) 2023-01-06

Similar Documents

Publication Publication Date Title
CN111045794A (en) Distributed transaction processing method, device, system, computer equipment and storage medium
WO2019085466A1 (en) Association test method and system, application server, and computer readable storage medium
CN112256776B (en) Form repeated submission detection method and device, computer equipment and storage medium
CN111127088B (en) Method, device, computer equipment and storage medium for realizing final consistency
CN105988865A (en) Roll-back processing method and device
US20120005330A1 (en) Organizing Individual Java Client Request Flows into a Single Server Transaction
CN111414263A (en) Information processing method, device, server and storage medium
CN105574026A (en) Method and device for service supporting by using non-relational database
CN115577031B (en) Database transaction processing method and device, electronic equipment and storage medium
CN112765126A (en) Database transaction management method and device, computer equipment and storage medium
CN109493230B (en) Supplementary recording method and device for unilateral transaction
CN116302652A (en) System alarm information processing method and device and electronic equipment
CN115292335A (en) Transaction processing method and device and electronic equipment
CN110908821B (en) Method, device, equipment and storage medium for task failure management
US7484215B2 (en) Method, system and program product for processing a transaction
US11500857B2 (en) Asynchronous remote calls with undo data structures
CN114816684A (en) Business processing method, device, equipment, readable storage medium and product
CN110765144B (en) Distributed heterogeneous database data processing method and device
CN114579260A (en) Transaction processing method and system
CN112669151A (en) Method and equipment for processing multi-system cooperative service
CN114510490B (en) Method and device for improving data insertion performance of database
CN114546705B (en) Operation response method, operation response device, electronic apparatus, and storage medium
CN105574020B (en) Database operation method and device
CN112732413B (en) Exception handling method, exception handling device, computer equipment and computer readable storage medium
CN114448929B (en) Data link switching method, device and system and computing equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant