CN115577031A - 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
CN115577031A
CN115577031A CN202211300898.5A CN202211300898A CN115577031A CN 115577031 A CN115577031 A CN 115577031A CN 202211300898 A CN202211300898 A CN 202211300898A CN 115577031 A CN115577031 A CN 115577031A
Authority
CN
China
Prior art keywords
completed
transaction
database
target database
interface
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.)
Granted
Application number
CN202211300898.5A
Other languages
Chinese (zh)
Other versions
CN115577031B (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

Images

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 database transaction processing device, an electronic device and a storage medium, wherein the method comprises the following steps: obtaining operation execution results of a plurality of databases participating in the transaction processing of the target database; when the operation execution result of any database is failure, detecting the interface priority of the failure 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 not performing data rollback on a database corresponding to any 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. When the overall influence of the failed operation on the target database transaction is small, data rollback is not performed on the database corresponding to the completed operation, and the completed operation does not need to be executed repeatedly, 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 application relates to the field of database technologies, and in particular, to a database transaction processing method and apparatus, an electronic device, and a storage medium.
Background
At present, with the development of internet technology, users have higher and higher requirements for database services, so that a situation that one database service needs to be implemented by a plurality of database joint operations often occurs, and the processing of database transactions is more and more complicated.
In the prior art, when one database transaction needs to be implemented by combining a plurality of databases, when the database operation of any one database fails to be executed, all related databases are rolled back, and the database transaction is executed again.
However, under the condition that there are many related databases and database operations included in database transactions are also many, if the database transactions are processed based on the prior art, a large number of related databases may perform data rollback for many times, which is not favorable for ensuring the processing efficiency of the database transactions.
Disclosure of Invention
The application provides a database transaction processing method, a database transaction processing device, an electronic device and a storage medium, which are used for overcoming 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:
obtaining operation execution results of a plurality of databases participating in the transaction processing of the target database;
when the operation execution result of any database is failure, detecting the interface priority of the failure operation and the interface priority of the completed operation; wherein the interface priority characterizes a degree of impact of transaction operations 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 performing data rollback on a database corresponding to any one 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 includes:
when the interface priority of the failed operation is higher than that of any one of the completed operations, performing data rollback on the database corresponding to the completed operation;
the completed operation and the failed operation are repeatedly performed.
Optionally, the method further includes:
judging whether the interface priority of the failed operation is higher than the interface priority of all the unexecuted operations;
when the interface priority of the failed operation is higher than that of all the unexecuted operations, suspending all the unexecuted operations until the failed operation is repeatedly executed.
Optionally, the method further includes:
and when the interface priority of the failed operation is lower than that of any one of the unexecuted operations, the unexecuted operation is executed normally.
Optionally, before obtaining the operation execution results of the databases participating in the transaction processing of the target database, the method further includes:
acquiring a service request of a user;
determining the 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 processing;
and calling service interfaces of the plurality of databases according to the operation content included in the target database transaction so as to execute corresponding transaction operation on the plurality of 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 for detecting the failed operation and the interface priority for detecting 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 establishing interface connection with a plurality of databases participating in the transaction processing of the target database includes:
acquiring connection information of the plurality of databases participating in the transaction processing of the target database; 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, including:
the acquisition module is used for acquiring operation execution results of a plurality of databases participating in the transaction processing of the target database;
the detection module is used for detecting the interface priority of the failed operation and the interface priority of the completed operation when the operation execution result of any database is failure; wherein the interface priority characterizes a degree of impact of transaction operations on the target database transaction;
the processing module is used for re-executing the failed operation when the interface priority of the failed operation is lower than the interface priority of each completed operation, and at the moment, data rollback is not performed on any database corresponding to the completed operation;
and the determining module is used for determining that the target database transaction is processed completely when all operations contained in the target database transaction are completed, so as to obtain 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 that of any one of the completed operations, performing data rollback on the 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 unexecuted operations;
when the interface priority of the failed operation is higher than that of all the unexecuted operations, suspending all the unexecuted operations until the failed operation is repeatedly executed.
Optionally, the processing module is further configured to:
and when the interface priority of the failed operation is lower than that of any one of the unexecuted operations, executing the unexecuted operation normally.
Optionally, the obtaining 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 processing;
and calling service interfaces of the plurality of databases according to the operation content included in the target database transaction so as to execute corresponding transaction operation on the plurality of 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 detection failure operation and the interface priority of the completed operation according to the service interface calling result corresponding to the failure operation and the service interface calling result corresponding to the completed operation.
Optionally, the obtaining module is specifically configured to:
acquiring connection information of a plurality of databases participating in the transaction processing of the target database; wherein the connection information at least comprises a database name, a database IP and a database port;
and establishing interface connection with the plurality of databases according to the connection information.
A third aspect of the present application provides an electronic device, comprising: at least one processor and memory;
the memory stores computer execution instructions;
the at least one processor executes computer-executable instructions stored by the memory to cause the at least one processor to perform the method as set forth in the first aspect above and in various possible designs of the first aspect.
A fourth aspect of the present application provides a computer-readable storage medium having stored thereon computer-executable instructions that, when executed by a processor, implement a method as set forth in the first aspect and 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 database transaction processing device, an electronic device and a storage medium, wherein the method comprises the following steps: acquiring operation execution results of a plurality of databases participating in transaction processing of a target database; when the operation execution result of any database is failure, detecting the interface priority of the failure operation and the interface priority of the completed operation; wherein the interface priority characterizes the degree of influence 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 not performing data rollback on a database corresponding to any 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. According to the method provided by the scheme, under the condition that the interface priority of the failed operation is low, namely when the failed operation has small influence on the whole target database transaction, data rollback is not performed 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, the drawings needed to be used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present application, and other drawings can be obtained by those skilled in the art according to these drawings.
FIG. 1 is a schematic structural diagram of a database transaction processing system according to an embodiment of the present application;
fig. 2 is a schematic flowchart of a database transaction processing method according to an embodiment of the present application;
fig. 3 is a schematic structural diagram of an exemplary database transaction processing system according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of a database transaction processing apparatus according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
With the above figures, there are shown specific embodiments of the present application, which will be described in more detail below. These drawings and written description are not intended to limit the scope of the disclosed concepts in any way, but rather to illustrate the concepts of the disclosure to those skilled in the art by reference to specific embodiments.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Furthermore, the terms "first", "second", etc. are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. In the description of the following examples, "plurality" means two or more unless specifically limited otherwise.
In the prior art, when one database transaction needs to be implemented by combining a plurality of databases, if the execution of the database operation of any database fails, the data of all relevant databases is rolled back, and the database transaction is re-executed. However, under the condition that there are many related databases and there are many database operations included in database transactions, if the database transactions are processed based on the prior art, a large number of related databases may all perform data rollback for many times, and the flexibility of database transaction processing is lacking, which is not favorable for ensuring the processing efficiency of database transactions.
In view of the foregoing problems, embodiments of the present application provide a database transaction processing method, an apparatus, an electronic device, and a storage medium, where the method includes: obtaining operation execution results of a plurality of databases participating in the transaction processing of the target database; when the operation execution result of any database is failure, detecting the interface priority of the failure operation and the interface priority of the completed operation; wherein the interface priority characterizes the degree of influence 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 not performing data rollback on a database corresponding to any 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. According to the method provided by the scheme, under the condition that the interface priority of the failed operation is low, namely when the failed operation has small influence on the whole target database transaction, data rollback is not performed 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 several specific embodiments may be combined with each other, and details of the same or similar concepts or processes may not be repeated in some embodiments. Embodiments of the present invention will be described below with reference to the accompanying drawings.
First, a structure of a database transaction system on which the present application is based will be described:
the database transaction processing method, the database transaction processing device, the electronic equipment and the storage medium are suitable for processing database transactions related to 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, and mainly includes a data acquisition device, a plurality of databases, and a database transaction processing device. Specifically, the operation execution results of each database may be acquired by the data acquisition device in the target database transaction execution process, and the obtained data may be sent to the database transaction processing device, which 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 related to joint operation of a plurality of databases. The execution subject of the embodiment of the present application is an electronic device, such as a server, a desktop computer, a notebook computer, a tablet computer, and other electronic devices that can be used for processing database transactions.
As shown in fig. 2, a schematic flow chart of a database transaction processing method provided in 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 processing.
Specifically, after any transaction operation in the target database transaction is completed, the execution result of the transaction operation may be obtained in the database corresponding to the transaction operation, so as to determine whether the transaction operation is successfully executed.
Step 202, when the operation execution result of any database is failure, detecting the interface priority of the failure operation and the interface priority of the completed operation.
Wherein the interface priority characterizes the degree of influence 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 in the execution process of the target database transaction, the transaction operations are at least divided into three types, namely, completed operations, failed operations and unexecuted operations. In the target database transaction processing process, the transaction operations included in the target database transaction can be executed in parallel or in series.
Step 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 degree of influence of the failed operation on the target database transaction is small, and the success or failure of the failed operation has no influence on the execution of the completed operation, so that at this time, data rollback is not performed on the database corresponding to any completed operation, and the completed operation does not need to be repeatedly executed, but the failed operation is only repeatedly executed until the execution is successful.
And step 204, 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.
Specifically, when all transaction operations in the target database transaction are completed operations, it may be determined that the target database transaction is completed, and at this time, a processing result of the target database transaction may be obtained.
On the basis of the foregoing embodiment, as an implementable manner, 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 executed.
Specifically, when the interface priority of the failed operation is higher than the interface priority of any completed operation, the interface priority representing the failed operation is higher, and the execution result of the failed operation has an influence 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, 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, in order to further improve the processing efficiency of the target database transaction, it may be further determined whether the interface priority of the failed operation is higher than the interface priorities of all the unexecuted operations; when the interface priority of the failed operation is higher than that of all the unexecuted operations, all the unexecuted operations are suspended until the failed operation is completed and the repeated execution is carried out.
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 executed normally.
Specifically, when the interface priority of the failed operation is higher than the interface priorities of all the unexecuted operations, it may be determined that the failed operation has a large influence on the target database transaction, and the execution result of the failed operation may affect the unexecuted operations to be executed subsequently, so that all the unexecuted operations are suspended, and the unexecuted operations are started after the failed operation is repeatedly executed.
Accordingly, when the interface priority of the failed operation is lower than that of any of the unexecuted operations, it can be determined that the success or failure of the failed operation has no influence on the execution of the unexecuted operation, and thus the unexecuted operation does not need to be suspended and can be normally executed.
On the basis of the foregoing embodiment, as an implementable manner, in an embodiment, before obtaining operation execution results of a plurality of databases participating in the target database transaction, the method further includes:
step 401, obtaining a service request of a user;
step 402, according to the service request, determining the target database transaction of the user, and establishing interface connection with a plurality of databases participating in the target database transaction processing;
step 403, according to the operation content included in the target database transaction, invoking the service interfaces of the databases to execute corresponding transaction operations on the databases based on the service interfaces.
Exemplarily, as shown in fig. 3, a schematic structural diagram of an exemplary database transaction processing system provided in the embodiment of the present application is provided, and the method provided in the embodiment of the present application is applied to a background service and a custom transaction manager. The method comprises the steps that a user sends a service request to a background service based on a client, the background service maintains a data table containing all database connection information in a unified mode, when the background service receives the service request, a corresponding target database transaction is determined at first, and then interface connection is established between the background service and a plurality of databases participating in the target database transaction processing according to the data table. In the process of executing the target database transaction, according to the content of the currently executed transaction operation, a corresponding service interface is called for the transaction operation so as to perform transaction operations such as increasing, deleting, modifying, checking and the like on the corresponding database. And when executing a transaction operation, feeding back an execution result of the transaction operation to the user-defined transaction manager, wherein the user-defined transaction manager judges whether to roll back data of the database corresponding to the completed operation based on the database transaction processing method provided by the embodiment, judges whether to suspend processing of the unexecuted operation, finally sends a judgment result to the background service, and executes corresponding business operation according to the judgment result by the background service.
Specifically, in an embodiment, connection information of a plurality of databases participating in transaction processing of a target database may be obtained; the connection information at least comprises a database name, a database IP and a database port; and establishing interface connection with the 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 connection number allowed by the database, a connection state, an addition time, a transaction operation type, and the like.
On the basis of the foregoing embodiment, as an implementable 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 for detecting the failed operation and the interface priority for detecting 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, before the target database transaction is executed, the interface priority of each service interface may be preset, 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 interface priority corresponding to each service interface may be set according to actual requirements, and the embodiment of the present application is not limited.
According to the database transaction processing method provided by the embodiment of the application, 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 failure operation and the interface priority of the completed operation; wherein the interface priority characterizes the degree of influence 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 not performing data rollback on a database corresponding to any 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. According to the method provided by the scheme, under the condition that the interface priority of the failed operation is low, namely when the failed operation has small influence on the whole target database transaction, data rollback is not performed on the database corresponding to the completed operation, the completed operation does not need to be repeatedly executed, the flexibility of 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 apparatus according to an embodiment of the present application. The database transaction processing apparatus 40 includes: an acquisition module 401, a detection module 402, a processing module 403 and a determination module 404.
The system comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring operation execution results of a plurality of databases participating in transaction processing of a target database; the detection module is used for detecting the interface priority of the failed operation and the interface priority of the completed operation when the operation execution result of any database is failure; wherein the interface priority characterizes the degree of influence of the transaction operation on the target database transaction; the processing module is used for re-executing the failed operation when the interface priority of the failed operation is lower than the interface priority of each completed operation, and at the moment, data rollback is not performed on the database corresponding to any completed operation; and the determining module is used for determining that the target database transaction is processed completely when all operations contained in the target database transaction are completed, so as to obtain 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 that of any operation completed, performing 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 unexecuted operations;
when the interface priority of the failed operation is higher than that of all the unexecuted operations, all the unexecuted operations are suspended until the failed operation is completed and the repeated execution is carried out.
Specifically, in an embodiment, the processing module is further configured to:
when the interface priority of the failed operation is lower than that 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 processing;
and calling service interfaces of the plurality of databases according to the operation content included in the target database transaction so as to execute corresponding transaction operation on the plurality of 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 for detecting the failed operation and the interface priority for detecting 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 transaction processing of a target database; 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.
With regard to the database transaction processing apparatus in the embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be described in detail here.
The database transaction processing apparatus provided in the embodiment of the present application is configured to execute the database transaction processing method provided in the foregoing embodiment, and an implementation manner and a principle thereof are the same and are not described again.
The embodiment of the present application provides an electronic device, configured to execute the database transaction processing method provided in the foregoing 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; the at least one processor executes the memory-stored computer-executable instructions to cause the at least one processor to perform the database transaction processing method provided by the above embodiments.
The electronic device provided in the embodiment of the present application is configured to execute the database transaction processing method provided in the foregoing embodiment, and an implementation manner and a principle of the electronic device are the same, and are not described again.
The embodiment of the present application provides a computer-readable storage medium, in which computer execution instructions are stored, and when a processor executes the computer execution instructions, the database transaction processing method provided in any embodiment above is implemented.
The storage medium including the computer-executable instructions of the embodiment of the present application may be used to store the computer-executable instructions of the database transaction processing method provided in the foregoing embodiment, and the implementation manner and the principle thereof are the same and are not described again.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed 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 can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional unit.
The integrated unit implemented in the form of a software functional unit may be stored in a computer-readable storage medium. The software functional unit is stored in a storage medium and includes several instructions to enable a computer device (which may be a personal computer, a server, or a network device) or a processor (processor) to execute some steps of the methods according to the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
It is obvious to those skilled in the art that, for convenience and simplicity of description, the foregoing division of the functional modules is merely used as an example, and in practical applications, the above function distribution may be performed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to perform all or part of the above described functions. For the specific working process of the device described above, reference may be made 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 used for illustrating the technical solutions 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 solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present application.

Claims (10)

1. A database transaction processing method, comprising:
acquiring operation execution results of a plurality of databases participating in transaction processing of a target database;
when the operation execution result of any database is failure, detecting the interface priority of the failure operation and the interface priority of the completed operation; wherein the interface priority characterizes a degree of impact of transaction operations 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 performing 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.
2. The method of claim 1, further comprising:
when the interface priority of the failed operation is higher than that of any one of the completed operations, performing data rollback on the database corresponding to the completed operation;
the completed operation and the failed operation are repeatedly performed.
3. The method of claim 2, further comprising:
judging whether the interface priority of the failed operation is higher than the interface priority of all the unexecuted operations;
when the interface priority of the failed operation is higher than that of all the unexecuted operations, suspending all the unexecuted operations until the failed operation is repeatedly executed.
4. The method of claim 3, further comprising:
and when the interface priority of the failed operation is lower than that of any one of the unexecuted operations, the unexecuted operation is executed normally.
5. The method of claim 1, wherein prior to obtaining results of performing operations on a number of databases participating in a target database transaction, the method further comprises:
acquiring a service request of a user;
determining the 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 processing;
and calling service interfaces of the plurality of databases according to the operation content included in the target database transaction so as to execute corresponding transaction operation on the plurality of databases based on the service interfaces.
6. The method of claim 5, wherein the 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 detection failure operation and the interface priority of the completed operation according to the service interface calling result corresponding to the failure operation and the service interface calling result corresponding to the completed operation.
7. The method of claim 5, wherein the interfacing with the plurality of databases participating in the target database transaction comprises:
acquiring connection information of the plurality of databases participating in the transaction processing of the target database; wherein the connection information at least comprises a database name, a database IP and a database port;
and establishing interface connection with the plurality of databases according to the connection information.
8. A database transaction apparatus, comprising:
the acquisition module is used for acquiring operation execution results of a plurality of databases participating in transaction processing of the target database;
the detection module is used for detecting the interface priority of the failed operation and the interface priority of the completed operation when the operation execution result of any database is failure; wherein the interface priority characterizes a degree of impact of transaction operations on the target database transaction;
the processing module is used for re-executing the failed operation when the interface priority of the failed operation is lower than the interface priority of each completed operation, and at the moment, data rollback is not performed on a database corresponding to any one completed operation;
and the determining module is used for determining that the target database transaction is processed completely when all operations contained in the target database transaction are completed, so as to obtain a processing result of the target database transaction.
9. An electronic device, comprising: at least one processor and a memory;
the memory stores computer execution instructions;
execution of the computer-executable instructions stored by the memory by the at least one processor causes the at least one processor to perform the method of any one of claims 1 to 7.
10. A computer-readable storage medium having stored thereon computer-executable instructions which, when executed by a processor, implement the method of any one of claims 1 to 7.
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 true CN115577031A (en) 2023-01-06
CN115577031B 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 (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040010500A1 (en) * 2002-07-09 2004-01-15 Madduri Seshachala Kumar Method, apparatus and article of manufacture to aggregate automated transaction procession
CN101667178A (en) * 2008-09-01 2010-03-10 北京数码大方科技有限公司 Transaction processing method used for C/S architecture file management system
US20120030184A1 (en) * 2010-07-27 2012-02-02 Sap Ag Distributed database system utilizing an extended two-phase-commit process
CN104243438A (en) * 2013-06-24 2014-12-24 阿里巴巴集团控股有限公司 Database transaction processing method and server
CN105893395A (en) * 2015-01-26 2016-08-24 阿里巴巴集团控股有限公司 Message re-checking method and system of distributed transaction
US20170046364A1 (en) * 2015-08-10 2017-02-16 International Business Machines Corporation Optimizing online schema processing for busy database objects
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
CN112231144A (en) * 2020-09-29 2021-01-15 上海艾融软件股份有限公司 Data processing method and device and electronic equipment
CN113760924A (en) * 2020-10-28 2021-12-07 北京沃东天骏信息技术有限公司 Distributed transaction processing method and device
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 (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040010500A1 (en) * 2002-07-09 2004-01-15 Madduri Seshachala Kumar Method, apparatus and article of manufacture to aggregate automated transaction procession
CN101667178A (en) * 2008-09-01 2010-03-10 北京数码大方科技有限公司 Transaction processing method used for C/S architecture file management system
US20120030184A1 (en) * 2010-07-27 2012-02-02 Sap Ag Distributed database system utilizing an extended two-phase-commit process
CN104243438A (en) * 2013-06-24 2014-12-24 阿里巴巴集团控股有限公司 Database transaction processing method and server
CN105893395A (en) * 2015-01-26 2016-08-24 阿里巴巴集团控股有限公司 Message re-checking method and system of distributed transaction
US20170046364A1 (en) * 2015-08-10 2017-02-16 International Business Machines Corporation Optimizing online schema processing for busy database objects
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
CN112231144A (en) * 2020-09-29 2021-01-15 上海艾融软件股份有限公司 Data processing method and device and electronic equipment
CN113760924A (en) * 2020-10-28 2021-12-07 北京沃东天骏信息技术有限公司 Distributed transaction processing method and device
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

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
LEI CUI; ZHIYU HAO; YAQIONG PENG; XIAOCHUN YUN;: "Piccolo: A Fast and Efficient Rollback System for Virtual Machine Clusters", pages 2328 - 2341 *
吴江,杨红雨,黄晓冬,李太勇: "基于操作***的实时数据库移植", no. 07, pages 78 - 79 *
支凤稳;云仲伦;张闪闪;: "基于区块链的个人科学数据共享模式研究", pages 69 - 78 *

Also Published As

Publication number Publication date
CN115577031B (en) 2023-07-25

Similar Documents

Publication Publication Date Title
CN109542964B (en) Data calling method and data calling system
CN111245900B (en) Distributed message sending processing system and processing method thereof
WO2019085466A1 (en) Association test method and system, application server, and computer readable storage medium
CN109614270A (en) Data read-write method, device, equipment and storage medium based on Hbase
CN105574026A (en) Method and device for service supporting by using non-relational database
CN112632093A (en) Work order processing method, device, system, storage medium and program product
CN115577031B (en) Database transaction processing method and device, electronic equipment and storage medium
CN116739524A (en) Business process setting method, device, equipment, storage medium and program product
CN116302652A (en) System alarm information processing method and device and electronic equipment
CN106940867B (en) Financial transaction method and device
US7484215B2 (en) Method, system and program product for processing a transaction
CN114816684A (en) Business processing method, device, equipment, readable storage medium and product
US11500857B2 (en) Asynchronous remote calls with undo data structures
CN113703979A (en) Resource processing method and device, resource processing equipment and storage medium
CN115934260A (en) Distributed transaction commit method and device based on XA two-phase commit protocol
CN114722261A (en) Resource processing method and device, electronic equipment and storage medium
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
CN117177050B (en) Virtual machine VPC network configuration snapshot processing method and system
CN112732413B (en) Exception handling method, exception handling device, computer equipment and computer readable storage medium
CN111967960B (en) Batch adjustment method and device for account data
CN113849278A (en) Global transaction processing method and system
CN115390999A (en) Distributed transaction execution method and device
CN117539540A (en) Binding method and device for monitor, storage medium and computer equipment
CN117251285A (en) Dynamic loading method, device, equipment and storage medium of configuration information

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