CN117453698A - Transaction processing method, device, computer equipment and storage medium - Google Patents

Transaction processing method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN117453698A
CN117453698A CN202311212791.XA CN202311212791A CN117453698A CN 117453698 A CN117453698 A CN 117453698A CN 202311212791 A CN202311212791 A CN 202311212791A CN 117453698 A CN117453698 A CN 117453698A
Authority
CN
China
Prior art keywords
transaction
application
logic
transaction data
transactions
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311212791.XA
Other languages
Chinese (zh)
Inventor
朱秋英
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hefei Yirui Communication Technology Co Ltd
Original Assignee
Hefei Yirui Communication 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 Hefei Yirui Communication Technology Co Ltd filed Critical Hefei Yirui Communication Technology Co Ltd
Priority to CN202311212791.XA priority Critical patent/CN117453698A/en
Publication of CN117453698A publication Critical patent/CN117453698A/en
Pending legal-status Critical Current

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/23Updating
    • G06F16/2308Concurrency control
    • 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

Landscapes

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

Abstract

The application provides a transaction processing method, a transaction processing device, computer equipment and a storage medium, wherein the transaction processing method comprises the following steps: acquiring a transaction data table to be processed, wherein the transaction data table comprises a plurality of logic transactions and a plurality of batches of logic transaction data corresponding to each logic transaction, and each logic transaction is configured with a transaction number; according to the transaction numbers, packing multiple batches of logic transaction data corresponding to each logic transaction to obtain application transactions and application transaction data corresponding to the application transactions; in response to an execution instruction aiming at an application transaction, a database transaction is called to carry out transaction processing on application transaction data to generate a transaction processing result.

Description

Transaction processing method, device, computer equipment and storage medium
Technical Field
The present invention relates to the field of database technologies, and in particular, to a transaction processing method, a transaction processing device, a computer device, and a storage medium.
Background
A transaction is a set of operations on data in a computer system that ensure that all execute successfully before the transaction execution completes. If a step in the middle of the set of operations fails to execute, the entire set of operations need to fall back to the original state. The large database system has a stable transaction mechanism, can ensure that the operation of a group of data is either completely executed or not executed at the database layer, and in the relational database system, one transaction can be an SQL statement, a group of SQL statements or a program.
For a large-scale computer application system, related business processing is often complicated, the complexity of an operation process in a Transaction is brought, and operations which cannot be directly processed through an embedded database Transaction (Transaction) exist, for example, some complex logic business operations and some special business operations in upper software need to be executed at intervals and in a cross mode between the computing processing of the upper software and the database operation after the Transaction is started, so that the execution time of the Transaction can be caused to include not only the time of the database operation but also the time of the computing processing of the upper software, the execution time of the Transaction is prolonged, and the efficiency of the Transaction processing is reduced.
Disclosure of Invention
Based on the foregoing, it is necessary to provide a transaction processing method, apparatus, computer device and storage medium, so as to solve the technical problems of complex transaction and insufficient special transaction in the embedded database transaction, and improve the transaction processing efficiency.
In a first aspect, the present application provides a transaction processing method, including:
acquiring a transaction data table to be processed, wherein the transaction data table comprises a plurality of logic transactions and a plurality of batches of logic transaction data corresponding to each logic transaction, each logic transaction is configured with a transaction number, and the transaction number is used for distinguishing the functions realized by the logic transactions;
according to the transaction numbers, each logical transaction and a plurality of batches of logical transaction data corresponding to each logical transaction are respectively packaged to obtain application transactions and application transaction data corresponding to the application transactions;
and responding to the execution instruction aiming at the application transaction, calling a database transaction to carry out transaction processing on the application transaction data, and generating a transaction processing result.
In some embodiments of the present application, before the obtaining the pending transaction data table, the method further includes:
When receiving a plurality of batches of logic transaction data of a function, storing the plurality of batches of logic transaction data into one logic transaction;
obtaining a plurality of logic transactions, numbering the logic transactions according to the difference of functions, and obtaining the transaction numbers;
and sequentially numbering each batch of logic transaction data according to the writing sequence of each batch of logic transaction data to obtain transaction sub-numbers.
In some embodiments of the present application, according to the transaction number, each of the logical transactions and a plurality of batches of logical transaction data corresponding to each of the logical transactions are respectively packaged to obtain an application transaction and application transaction data corresponding to the application transaction, including:
merging the logic transactions corresponding to the same transaction number into one application transaction;
and merging the multiple batches of logic transaction data of the logic transactions corresponding to the same transaction number into the application transaction data.
In some embodiments of the present application, the invoking the database transaction performs a transaction on the application transaction data to generate a transaction result, including:
taking the transaction sub-number as the execution priority of each batch of logic transaction data in the application transaction;
And calling the database transaction, and performing transaction processing on each batch of the logic transaction data in the application transaction data according to the execution priority of each batch of the logic transaction data to generate the transaction processing result.
In some embodiments of the present application, after the packaging processing is performed on each of the logical transactions and the plurality of batches of logical transaction data corresponding to each of the logical transactions according to the transaction numbers, to obtain an application transaction and application transaction data corresponding to the application transaction, the method further includes:
creating a file database table and a memory database table, wherein the table structures of the file database table and the memory database table are kept consistent;
storing the application transaction and the application transaction data of the application transaction into the memory database table;
and synchronizing the memory database table to the file database table at regular time.
In some embodiments of the present application, after the packaging processing is performed on each of the logical transactions and the plurality of batches of logical transaction data corresponding to each of the logical transactions according to the transaction numbers, to obtain an application transaction and application transaction data corresponding to the application transaction, the method further includes:
Creating a file database table and a memory database table, wherein the table structures of the file database table and the memory database table are kept consistent;
and storing the application transaction and the application transaction data of the application transaction into the memory database table or the file database table.
In some embodiments of the present application, the invoking the database transaction performs a transaction on the application transaction data to generate a transaction result, including:
when the transaction is a query and/or insert operation, performing a transaction on the application transaction data in the memory database table;
and when the transaction processing is deleting and/or updating operation, performing transaction processing on the application transaction data in the memory database table and the file database table.
In a second aspect, the present application provides a transaction processing device comprising:
the system comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring a transaction data table to be processed, the transaction data table comprises a plurality of logic transactions and a plurality of batches of logic transaction data corresponding to the logic transactions, each logic transaction is configured with a transaction number, and the transaction number is used for distinguishing the functions realized by the logic transactions;
The packaging module is used for respectively packaging each logic transaction and a plurality of batches of logic transaction data corresponding to each logic transaction according to the transaction number to obtain an application transaction and application transaction data corresponding to the application transaction;
and the processing module is used for calling a database transaction to conduct transaction processing on the application transaction data in response to the execution instruction aiming at the application transaction, and generating a transaction processing result.
In some embodiments of the present application, the transaction device further includes:
the first storage module is used for storing a plurality of batches of logic transaction data in one logic transaction when receiving the plurality of batches of logic transaction data of one function;
the first numbering module is used for obtaining a plurality of logic transactions, numbering the logic transactions according to the difference of functions and obtaining the transaction numbers;
and the second numbering module is used for sequentially numbering each batch of logic transaction data according to the writing sequence of each batch of logic transaction data to obtain transaction sub-numbers.
In some embodiments of the present application, the packaging module is specifically configured to: merging the logic transactions corresponding to the same transaction number into one application transaction; and merging the multiple batches of logic transaction data of the logic transactions corresponding to the same transaction number into the application transaction data.
In some embodiments of the present application, the processing module is specifically configured to: taking the transaction sub-number as the execution priority of each batch of logic transaction data in the application transaction; and calling the database transaction, and performing transaction processing on each batch of the logic transaction data in the application transaction data according to the execution priority of each batch of the logic transaction data to generate the transaction processing result.
In some embodiments of the present application, the transaction device further includes:
the system comprises a creation module, a storage module and a storage module, wherein the creation module is used for creating a file database table and a memory database table, and the table structures of the file database table and the memory database table are kept consistent;
the second saving module is used for saving the application transaction and the application transaction data of the application transaction into the memory database table;
and the synchronization module is used for synchronizing the memory database table to the file database table at regular time.
In some embodiments of the present application, the transaction device further includes:
the system comprises a creation module, a storage module and a storage module, wherein the creation module is used for creating a file database table and a memory database table, and the table structures of the file database table and the memory database table are kept consistent;
and the third saving module is used for saving the application transaction and the application transaction data of the application transaction to the memory database table or the file database table.
In some embodiments of the present application, the processing module is specifically further configured to: when the transaction is a query and/or insert operation, performing a transaction on the application transaction data in the memory database table; and when the transaction processing is deleting and/or updating operation, performing transaction processing on the application transaction data in the memory database table and the file database table.
In a third aspect, the present application also provides a computer device comprising:
one or more processors;
a memory; and one or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the processor to implement the transaction method.
In a fourth aspect, the present application also provides a computer readable storage medium having stored thereon a computer program to be loaded by a processor for performing the steps of a transaction method.
The transaction processing method, the device, the computer equipment and the storage medium are characterized in that a transaction data table to be processed is obtained, the transaction data table comprises a plurality of logic transactions and a plurality of batches of logic transaction data corresponding to each logic transaction, and each logic transaction is configured with a transaction number; according to the transaction numbers, packing multiple batches of logic transaction data corresponding to each logic transaction to obtain application transactions and application transaction data corresponding to the application transactions; in response to an execution instruction aiming at an application transaction, a database transaction is called to carry out transaction processing on application transaction data to generate a transaction processing result.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the description of the embodiments will be briefly introduced below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a transaction method according to an embodiment of the present application;
FIG. 2 is a diagram of an architecture of a transaction processing system in one embodiment of the present application;
FIG. 3 is a schematic diagram of a transaction device according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of a computer device in the embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are only some, but not all, of the embodiments of the present application. All other embodiments, which can be made by those skilled in the art based on the embodiments herein without making any inventive effort, are intended to be within the scope of the present application.
In the description of the present application, the terms "first," "second," and the like 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. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include one or more of the described features. In the description of the present application, the meaning of "a plurality" is two or more, unless explicitly defined otherwise.
In the description of the present application, the term "for example" is used to mean "serving as an example, instance, or illustration. Any embodiment described herein as "for example" is not necessarily to be construed as preferred or advantageous over other embodiments. The following description is presented to enable any person skilled in the art to make and use the invention. In the following description, details are set forth for purposes of explanation. It will be apparent to one of ordinary skill in the art that the present invention may be practiced without these specific details. In other instances, well-known structures and processes have not been described in detail so as not to obscure the description of the invention with unnecessary detail. Thus, the present invention is not intended to be limited to the embodiments shown, but is to be accorded the widest scope consistent with the principles and features disclosed herein.
In order to better understand the technical scheme of the embodiment of the invention, first, the complex business logic operation and the special operation are explained. The complex business logic operation and the special operation refer to operations that cannot be directly processed through an embedded database Transaction (Transaction), such as long-time interval operation, different menu operation or preprocessing operation, and the complex business logic operation and the special operation under three application scenarios. The long-time interval operation refers to that a plurality of operations are associated with each other, and a time interval between at least two operations is long, for example, after a user performs a first operation, a waiting period is needed to wait for data of a third party system, for example, after other needed data is acquired, a second operation can be performed, where the first operation and the second operation form a complete transaction on service logic of a corresponding system, that is, a combination of the first operation and the second operation is a complex service operation. The different menu operations are that operations need to be performed on different menus respectively, and for example, a third operation and a fourth operation of a user are performed in different menus, after the third operation is completed in the first menu, the user needs to return to a main interface, and then enter the second menu to perform the fourth operation, and at this time, the third operation and the fourth operation form a complete transaction on service logic of a corresponding system, namely, a combination of the third operation and the fourth operation is a complex service operation. The preprocessing operation refers to that a part of data needs to be preprocessed in combination with the preprocessing operation and the subsequent operation, for example, for an operation with large workload, a fifth operation may be preprocessed in advance, but the preprocessed data obtained by the fifth operation cannot be submitted to the database as a complete transaction, and further, subsequent data obtained by the subsequent sixth operation needs to be processed, and then, transaction processing is performed in combination with the preprocessed data and the subsequent data, namely, a combination of the fifth operation and the sixth operation is a special service operation. The three operations in this embodiment are just the complex business logic operations and special operations in several application scenarios, and may also be the complex business logic operations and special operations in other application scenarios.
Fig. 1 is a schematic flow chart of an embodiment of a transaction processing method in the embodiment of the present application, where the transaction processing method is applied to a terminal or a server, and the embodiment is exemplified by the application to the server. The execution subject of the transaction method is a server, and the transaction method may include the following steps 101 to 103, specifically as follows:
101, acquiring a transaction data table to be processed, wherein the transaction data table comprises a plurality of logic transactions and a plurality of batches of logic transaction data corresponding to the logic transactions, each logic transaction is configured with a transaction number, and the transaction number is used for distinguishing functions realized by the logic transactions.
The transaction data table refers to a table that needs to perform a transaction process and records transaction data, and in this embodiment, the transaction data table includes a plurality of logic transactions, each logic transaction includes a plurality of batches of logic transaction data, where a logic transaction refers to a plurality of transactions for implementing a certain function, for example, in an application scenario of "long-time interval operation" in the above scenario, a first operation is one logic transaction, and a second operation is one logic transaction. Logical transaction data refers to transaction data in one logical transaction. The transaction number refers to the identification of the logic transaction, and can be represented by a combination of numbers and characters, and is used for distinguishing the functions realized by the logic transaction, namely if the functions realized by several logic transactions are the same, the transaction numbers are the same, and taking the application scenario of 'long time interval operation' in the above scenario as an example, the transaction number of the first operation is the same as the transaction number of the second operation; taking the application scenario of "different menu operations" in the above scenario as an example, the transaction number of the third operation is the same as the transaction number of the fourth operation.
In one example, a node of a business process needs to update 10 fields of a record in a database, wherein 7 fields of data need to be input manually, the 7 fields of data input work forms a logical transaction, that is, a logical transaction, and the remaining 3 fields of data need to be calculated by means of the 7 fields, or the 7 fields are transmitted to a third party system and can be acquired after being communicated with the third party system once, so that the data acquisition of the remaining 3 fields forms a logical transaction.
In another example, for a scenario requiring 100 pieces of data to be entered, if each piece of data is to be executed as one transaction, each piece of data may be regarded as one logical transaction, 100 logical transactions are generated, and if 50 pieces of data are to be executed as one transaction while waiting for 50 pieces of data to be entered, 50 pieces of data may be regarded as one logical transaction, generating 2 logical transactions.
Specifically, multiple batches of transaction data can be stored in a memory table or a file system in advance, multiple batches of transaction data are stored into one logic transaction according to one logic transaction initiated by a client, the logic transaction is numbered according to the implementation function of each logic transaction, and then the numbers of the logic transaction, the logic transaction and the multiple batches of transaction data are recorded in a table to form a transaction data table, so that the transaction data table can be obtained from a server.
In a specific embodiment, before the step 101 of obtaining the transaction data table to be processed, the method may further include the following steps 104 to 106, which are specifically as follows:
104, when receiving a plurality of batches of logic transaction data of one function, storing the plurality of batches of logic transaction data into one logic transaction;
105, obtaining a plurality of logic transactions, numbering the logic transactions according to the difference of functions, and obtaining the transaction numbers;
106, sequentially numbering each batch of logic transaction data according to the writing sequence of each batch of logic transaction data to obtain transaction sub-numbers.
The transaction sub-number refers to a number allocated to each batch of logic transactions in the logic transactions, and can be identified by numbers, such as 1, 2, 3, 4, and the like.
Specifically, when the server receives multiple batches of logic transaction data of one function, the multiple batches of logic transaction data of the function are stored in one logic transaction, so that when multiple logic transactions are acquired, a GUID (global unique identifier, globally Unique Identifier) algorithm is adopted to generate a transaction number according to the function of the logic transaction, and the uniqueness of the numbers of the logic transactions in each function is ensured. For each batch of logic transaction data, the number can be carried out according to the writing sequence of each batch of logic transaction data, for example, each batch of logic transaction data is written, the transaction sub-number of the batch of logic transaction data is increased by 1, so that the transaction sub-number can not only distinguish each batch of logic transaction data, but also reflect the writing sequence of the logic transaction data, and the sequential execution of each batch of logic transaction data can be realized based on the transaction sub-number. It can be appreciated that in this embodiment, by numbering the logic transaction and the logic transaction data, analysis and arrangement of the logic transaction and the logic transaction data are realized, so that the logic transaction and the logic transaction data are processed efficiently based on the transaction number and the transaction sub-number.
102, respectively packaging each logic transaction and a plurality of batches of logic transaction data corresponding to each logic transaction according to the transaction numbers to obtain application transactions and application transaction data corresponding to the application transactions.
The packing processing is a data processing mode for combining a plurality of logic transactions with a plurality of batches of logic transaction data corresponding to each logic transaction to realize the combination of the plurality of logic transactions and the combination of the plurality of batches of logic transaction data corresponding to the logic transactions. The application transaction is a complete transaction after a plurality of logic transactions are combined, and the application transaction data is the logic transaction data after a plurality of batches of logic transaction data corresponding to all logic transactions in the application transaction are combined.
Specifically, the function realized by the logic transaction can be distinguished by the transaction number, so that the multi-batch logic transaction data corresponding to each logic transaction is packaged according to the transaction number, the classification and arrangement of each logic transaction are realized, and the application transaction is ensured to be a complete transaction.
In a specific embodiment, in step 102, according to the transaction number, each logical transaction and a plurality of batches of logical transaction data corresponding to each logical transaction are respectively packaged to obtain an application transaction and application transaction data corresponding to the application transaction, which may include the following steps 102A to 102B, specifically as follows:
102A, merging the logic transactions corresponding to the same transaction number into one application transaction;
102B, merging the multiple batches of the logic transaction data of the logic transaction corresponding to the same transaction number into the application transaction data.
Specifically, the functions realized by the logic transactions with the same transaction numbers can be distinguished, so that the functions realized by the logic transactions with the same transaction numbers are the same functions, the logic transactions corresponding to the same transaction numbers are combined into one application transaction, so that one application transaction can realize a complete function, meanwhile, multiple batches of logic transaction data of the logic transactions corresponding to the same transaction numbers are combined into application transaction data, the integrity and the accuracy of the application transaction and the application transaction data are ensured, and the processing of multiple logic transactions is realized based on the application transaction and the application transaction data, thereby being beneficial to improving the processing efficiency of the multiple logic transactions.
Taking the first operation and the second operation in the step 101 as an example, because the transaction number of the first operation is the same as the transaction number of the second operation, the combination of the first operation and the second operation is an application transaction, and after the application transaction is executed, the long-time interval operation can be bound into one application transaction, so that the efficient processing of the operation of the complex business logic is realized; taking the third operation and the fourth operation in the step 101 as an example, similarly, the combination of the third operation and the fourth operation is an application transaction, and after the application transaction is executed, the binding of different menu operations into one application transaction can be realized, so that the efficient processing of the operation of the complex business logic is realized.
In step 102, according to the transaction number, each logical transaction and a plurality of batches of logical transaction data corresponding to each logical transaction are respectively packaged, so as to obtain an application transaction and application transaction data corresponding to the application transaction, and then the method further comprises the following steps 107 to 109, specifically as follows:
107, creating a file database table and a memory database table, wherein the table structures of the file database table and the memory database table are kept consistent;
108, storing the application transaction and the application transaction data of the application transaction into the memory database table;
and 109, timing synchronizing the memory database table to the file database table.
The memory database table refers to a database table in a memory (volatile storage, no information is stored after power failure), the file database table refers to a database table stored in a nonvolatile storage (hard disk or magnetic disk), and the file database table and the memory database table in the embodiment have the same table structure.
Specifically, a file database table and a memory database table with consistent table structures can be respectively created, application transaction data of application transactions and application transaction data of the application transactions are stored in the memory database table, and the memory database table is synchronized to the file database table at regular time.
It should be noted that, the table structure of the memory database table is created on the disk, the application transaction data is stored in the memory database table, and is initialized when the server is started, and the application transaction data in the memory database table is cached in the file database table when the server is stopped, so that the initialized memory database table can be read when the server is started next time. In the running process of the server, when the application transaction data in the memory database table is updated, the updated application transaction data can be buffered in the file database table, so that the loss of the application transaction data caused by sudden power failure is prevented, and the consistency of the application transaction data is ensured.
In a specific embodiment, in step 102, the packaging process is performed on each of the logical transactions and the multiple batches of logical transaction data corresponding to each of the logical transactions according to the transaction numbers, so as to obtain an application transaction and application transaction data corresponding to the application transaction, and then the method further includes the following steps 107 'to 108', which are specifically as follows:
107', creating a file database table and a memory database table, wherein the table structures of the file database table and the memory database table are kept consistent;
108', storing the application transaction and the application transaction data of the application transaction into the memory database table or the file database table.
Specifically, the application transaction and the application transaction data of the application transaction are saved in the memory database table or the file database table, and when the application transaction is executed subsequently, a flag can be set to identify whether the application transaction data is saved in the memory database table or the file database table. In this embodiment, the application transaction and the application transaction data of the application transaction are saved in the memory database table or the file database table, so that the efficient processing of the application transaction is realized based on the memory database table or the file database table.
And 103, calling a database transaction to conduct transaction processing on the application transaction data in response to an execution instruction aiming at the application transaction, and generating a transaction processing result.
Wherein, the database transaction is a transaction of a database application layer and is used for executing the transaction. The execution instruction refers to a command sent by the client to the server for executing the application transaction, and the transaction processing result refers to a result generated by executing the application transaction, for example, may be a result generated by executing one SQL statement, a set of SQL statements, or the like.
Specifically, the server calls the database transaction to conduct transaction processing on application transaction data, so that processing of a plurality of logic transactions in a transaction data table is achieved, and processing of complex transactions of an application layer is achieved. It can be understood that, by adopting the embodiment of the application, a plurality of logic transactions are combined into one application transaction according to the transaction number, so that analysis and arrangement of the plurality of logic transactions are realized, creation of the application transaction is completed, the database transaction is called to execute the application transaction, the processing mechanism is simple, the logic transaction data is packaged and the logic transaction is processed in an asynchronous mode, processing of complex logic transactions is realized, no perception of a user of a client is ensured, and the transaction processing efficiency is improved.
In this embodiment, a plurality of logic transactions are combined into one application transaction according to the transaction number, so that analysis and arrangement of the plurality of logic transactions are realized, creation of the application transaction is completed, the database transaction is called to execute the application transaction, the processing mechanism is simple, the logic transaction data and the logic transaction are packaged and processed in an asynchronous manner, processing of complex logic transactions is realized, no perception of a user of a client is ensured, and the transaction processing efficiency is improved.
In a specific embodiment, the step 103 of calling the database transaction to perform a transaction process on the application transaction data to generate a transaction result may include the following steps 103A to 103B, which are specifically as follows:
103A, taking the transaction sub-number as the execution priority of each batch of logic transaction data in the application transaction;
103B, calling the database transaction, and performing transaction processing on each batch of the logic transaction data in the application transaction data according to the execution priority of each batch of the logic transaction data to generate the transaction processing result.
Specifically, the transaction sub-number is used as the execution priority of each batch of logic transaction data in the application transaction, and the transaction processing is carried out on each batch of logic transaction data in the application transaction data according to the execution priority of each batch of logic transaction data, so that the ordering of the logic transaction data processing is ensured, and the transaction processing efficiency is further improved.
In a specific embodiment, the step 103 of calling the database transaction to perform a transaction process on the application transaction data to generate a transaction result may include the following steps 103C to 103D, which are specifically as follows:
103C, when the transaction processing is a query and/or insert operation, performing transaction processing on the application transaction data in the memory database table;
103D, when the transaction is a delete and/or update operation, performing a transaction on the application transaction data in the memory database table and the file database table.
Specifically, when the transaction processing is a query and/or insert operation, performing transaction processing on the application transaction data in the memory database table so as to speed up the processing speed of the application transaction data; when the transaction processing is deleting and/or updating operation, the transaction processing is carried out on the application transaction data in the internal database table and the file database table, so that the transaction processing of batched application transaction data can be realized, and the transaction processing efficiency is further improved.
The embodiment of the application provides a transaction processing system, which performs transaction processing by applying the scheme described in the above embodiment, as shown in fig. 2, and is an architecture diagram of the transaction processing system, where the transaction processing system includes a client 1, a server 2, and a database 3, where the client 1 includes a data display module 11, a data input/output module 12, and a first communication module 13; the server side 2 comprises a second communication module 21, a transaction interface module 22, a transaction detail data table 23, a transaction control table 24, a transaction monitoring module 25, a transaction execution result table 26, a transaction updating module 27 and a transaction manual management module 28; database 3 is an embedded database, such as sqlite, which has relatively weak transaction capabilities.
Taking a transaction processing method for changing data as an example, the working process of a transaction processing system is as follows: after a user logs in the system by using the client, a transaction operation is initiated, firstly, data needing to be changed is input in a foreground interaction interface, the data input and output module 12 obtains the data input by the user, the data is sent to the second communication module 21 of the server side 2 through the first communication module 13, the second communication module 21 forwards the received data to the transaction interface module 22, the server side 2 obtains a transaction data table to be processed, the transaction data table comprises a plurality of logic transactions and a plurality of batches of logic transaction data corresponding to each logic transaction, the transaction interface module 22 packages the plurality of logic transactions and the plurality of batches of logic transaction data corresponding to each logic transaction according to the data packet sizes of each logic transaction and each logic transaction in the transaction data table, so as to obtain application transaction data corresponding to application transactions and application transactions, and the application transaction data corresponding to the application transactions are automatically stored in the transaction detail data table 23 and the transaction control table 24, and further processing is performed on the basis of the transaction detail data table 23 and the application transaction data corresponding to the transaction control table 24. Each logic transaction is configured with a transaction number, the transaction number is used for distinguishing functions implemented by the logic transaction, and the transaction detail data table 23, the transaction control table 24 and the transaction execution result table 26 can be tables created in a server memory, wherein the transaction detail data table 23 comprises five fields of a transaction number, a transaction sub-number, a data sequence number, a data length and transaction data. The transaction number is a unique number of each application transaction, and the transaction sub-number is used for distinguishing each batch of application transaction data; the "data sequence number" is used to distinguish the order of each batch of logical transaction data, the "data length" is used to indicate the data length of a batch of logical transaction data, and the "transaction data" is a specific data in a batch of logical transaction data.
In response to an execution instruction for an application transaction, in one example, after a batch of logical transaction data has been written in its entirety, a particular piece of data may be written to the transaction detail data table 23 to indicate that the application transaction may initiate an operation, i.e., in response to an execution instruction for an application transaction. For example, a record of which the field value is "111" except for "transaction number" is written into the transaction detail data table 23 for responding to an execution instruction for the application transaction. The transaction control table 24 includes five fields, namely, a "transaction number", "user name", "whether to restart", "number of restarts", "end flag", which indicates whether the application transaction can start to be executed, which are kept in correspondence with the "transaction number" field in the transaction detail data table 23, and the "user name" field indicates which user the application transaction is initiated, the "whether to restart" field indicates whether to retry to be executed when the application transaction fails to be executed, the "number of restarts" field is used to specify the number of times to attempt restart, and the "end flag" indicates whether the application transaction can start to be executed. The transaction execution result table 26 includes three fields of "transaction number", "execution result", and "log information". The "execution result" field indicates whether the transaction is successful or failed, if the value is 0, it indicates that the transaction is successful in execution, if the value is 1, it indicates that the transaction is failed in execution, and when the execution fails, specific error reporting information is written in the "log information" field, and the transaction execution result table in this embodiment is used for storing the transaction processing result.
The database transaction is called to conduct transaction processing on application transaction data to generate a transaction processing result, the transaction monitoring module 25 is a daemon process of the server side 2 and is used for monitoring and judging whether a certain transaction in the transaction control table 24 can be started, if so, the detailed data of the transaction is extracted from the transaction detail data table 23 and submitted to the transaction updating module 27, the transaction updating module 27 is connected to the database 3, transaction execution of a database layer is started, the transaction processing result of the database 3 is returned to the transaction monitoring module 25, and the execution result is updated to the transaction execution result table 26 when the transaction monitoring module 25 receives the returned result. The server 2 performs transaction processing on the application transaction data through the database transaction, generates a transaction processing result, and can store the generated transaction processing result in the transaction execution result table 26.
Transaction manual management module 28 provides a management interface for logical transactions, as well as manual restart functionality. A logic transaction that can be restarted is set, and can be restarted manually by the module, and the transaction manual management module 28 restarts execution of the processing scheme of the logic transaction by notifying the transaction monitoring module 25.
In order to better implement the transaction method in the embodiment of the present application, based on the transaction method, the embodiment of the present application further provides a transaction processing device, as shown in fig. 3, where the transaction processing device 200 includes:
an obtaining module 201, configured to obtain a transaction data table to be processed, where the transaction data table includes a plurality of logic transactions and a plurality of batches of logic transaction data corresponding to each logic transaction, and each logic transaction is configured with a transaction number, where the transaction number is used to distinguish functions implemented by the logic transaction;
the packaging module 202 is configured to respectively package each of the logical transactions and a plurality of batches of logical transaction data corresponding to each of the logical transactions according to the transaction numbers, so as to obtain an application transaction and application transaction data corresponding to the application transaction;
and the processing module 203 is configured to respond to an execution instruction for the application transaction, invoke a database transaction to perform transaction processing on the application transaction data, and generate a transaction processing result.
In some embodiments of the present application, the transaction device further includes:
the first storage module is used for storing a plurality of batches of logic transaction data in one logic transaction when receiving the plurality of batches of logic transaction data of one function;
The first numbering module is used for obtaining a plurality of logic transactions, numbering the logic transactions according to the difference of functions and obtaining the transaction numbers;
and the second numbering module is used for sequentially numbering each batch of logic transaction data according to the writing sequence of the plurality of batches of logic transaction data to obtain transaction sub-numbers.
In some embodiments of the present application, the packaging module 202 is specifically configured to: merging the logic transactions corresponding to the same transaction number into one application transaction; and determining a plurality of batches of the logic transaction data of the logic transaction corresponding to the same transaction number as the application transaction data.
In some embodiments of the present application, the processing module 203 is specifically configured to: taking the transaction sub-number as the execution priority of each batch of logic transaction data in the application transaction; and calling the database transaction, and performing transaction processing on each batch of the logic transaction data in the application transaction data according to the execution priority of each batch of the logic transaction data to generate the transaction processing result.
In some embodiments of the present application, the transaction device further includes:
the system comprises a creation module, a storage module and a storage module, wherein the creation module is used for creating a file database table and a memory database table, and the table structures of the file database table and the memory database table are kept consistent;
The second saving module is used for saving the application transaction and the application transaction data of the application transaction into the memory database table;
and the synchronization module is used for synchronizing the memory database table to the file database table at regular time.
In some embodiments of the present application, the transaction device further includes: and the third saving module is used for saving the application transaction and the application transaction data of the application transaction to the memory database table or the file database table.
In some embodiments of the present application, the processing module 203 is specifically further configured to: when the transaction is a query and/or insert operation, performing a transaction on the application transaction data in the memory database table; and when the transaction processing is deleting and/or updating operation, performing transaction processing on the application transaction data in the memory database table and the file database table.
The embodiment of the application also provides a computer device, which integrates any of the transaction processing devices provided by the embodiment of the application, and the computer device comprises:
one or more processors;
a memory; and
one or more applications, wherein the one or more applications are stored in the memory and configured to perform the steps of the transaction method described in any of the transaction method embodiments above by the processor.
The embodiment of the application also provides a computer device which integrates any of the transaction processing devices provided by the embodiment of the application. As shown in fig. 4, a schematic structural diagram of a computer device according to an embodiment of the present application is shown, specifically:
the computer device may include one or more processing cores 'processors 301, one or more computer-readable storage media's memory 302, power supply 303, and input unit 304, among other components. Those skilled in the art will appreciate that the computer device structure shown in FIG. 4 is not limiting of the computer device and may include more or fewer components than shown, or may be combined with certain components, or a different arrangement of components. Wherein:
processor 301 is the control center of the computer device and uses various interfaces and lines to connect the various parts of the overall computer device, and to perform various functions and process data of the computer device by running or executing software programs and/or modules stored in memory 302, and invoking data stored in memory 302. Optionally, processor 301 may include one or more processing cores; preferably, the processor 301 may integrate an application processor and a modem processor, wherein the application processor primarily handles operating systems, user interfaces, applications, etc., and the modem processor primarily handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 301.
The memory 302 may be used to store software programs and modules, and the processor 301 executes various functional applications and data processing by executing the software programs and modules stored in the memory 302. The memory 302 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program (such as a sound playing function, an image playing function, etc.) required for at least one function, and the like; the storage data area may store data created according to the use of the computer device, etc. In addition, memory 302 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 302 may also include a memory controller to provide the processor 301 with access to the memory 302.
The computer device further includes a power supply 303 for powering the various components, preferably, the power supply 303 is logically connected to the processor 301 by a power management system, such that functions such as managing charging, discharging, and power consumption are performed by the power management system. The power supply 303 may also include one or more of any combination of direct current or alternating current power sources, recharging systems, power failure detection circuits, power converters or inverters, power status indicators, and the like.
The computer device may also include an input unit 304, which input unit 304 may be used to receive input numeric or character information and to generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.
Although not shown, the computer device may further include a display unit or the like, which is not described herein. In particular, in this embodiment, the processor 301 in the computer device loads executable files corresponding to the processes of one or more application programs into the memory 302 according to the following instructions, and the processor 301 executes the application programs stored in the memory 302, so as to implement various functions as follows:
acquiring a transaction data table to be processed, wherein the transaction data table comprises a plurality of logic transactions and a plurality of batches of logic transaction data corresponding to each logic transaction, each logic transaction is configured with a transaction number, and the transaction number is used for distinguishing the functions realized by the logic transactions;
according to the transaction numbers, each logical transaction and a plurality of batches of logical transaction data corresponding to each logical transaction are respectively packaged to obtain application transactions and application transaction data corresponding to the application transactions;
And responding to the execution instruction aiming at the application transaction, calling a database transaction to carry out transaction processing on the application transaction data, and generating a transaction processing result.
Those of ordinary skill in the art will appreciate that all or a portion of the steps of the various methods of the above embodiments may be performed by instructions, or by instructions controlling associated hardware, which may be stored in a computer-readable storage medium and loaded and executed by a processor.
To this end, embodiments of the present application provide a computer readable storage medium, which may include: read Only Memory (ROM), random access Memory (RAM, random Access Memory), magnetic or optical disk, and the like. On which a computer program is stored, which computer program is loaded by a processor for performing the steps of any of the transaction methods provided by the embodiments of the present application. For example, the loading of the computer program by the processor may perform the steps of:
acquiring a transaction data table to be processed, wherein the transaction data table comprises a plurality of logic transactions and a plurality of batches of logic transaction data corresponding to each logic transaction, each logic transaction is configured with a transaction number, and the transaction number is used for distinguishing the functions realized by the logic transactions;
According to the transaction numbers, each logical transaction and a plurality of batches of logical transaction data corresponding to each logical transaction are respectively packaged to obtain application transactions and application transaction data corresponding to the application transactions;
and responding to the execution instruction aiming at the application transaction, calling a database transaction to carry out transaction processing on the application transaction data, and generating a transaction processing result.
In the foregoing embodiments, the descriptions of the embodiments are focused on, and the portions of one embodiment that are not described in detail in the foregoing embodiments may be referred to in the foregoing detailed description of other embodiments, which are not described herein again.
In the implementation, each unit or structure may be implemented as an independent entity, or may be implemented as the same entity or several entities in any combination, and the implementation of each unit or structure may be referred to the foregoing method embodiments and will not be repeated herein.
The specific implementation of each operation above may be referred to the previous embodiments, and will not be described herein.
The foregoing has described in detail the methods, apparatuses and storage medium for transaction processing provided by the embodiments of the present application, and specific examples have been applied herein to illustrate the principles and embodiments of the present application, where the foregoing examples are provided to assist in understanding the methods and core ideas of the present application; meanwhile, those skilled in the art will have variations in the specific embodiments and application scope in light of the ideas of the present application, and the present description should not be construed as limiting the present application in view of the above.

Claims (10)

1. A method of transaction processing, comprising:
acquiring a transaction data table to be processed, wherein the transaction data table comprises a plurality of logic transactions and a plurality of batches of logic transaction data corresponding to each logic transaction, each logic transaction is configured with a transaction number, and the transaction number is used for distinguishing the functions realized by the logic transactions;
according to the transaction numbers, each logical transaction and a plurality of batches of logical transaction data corresponding to each logical transaction are respectively packaged to obtain application transactions and application transaction data corresponding to the application transactions;
and responding to the execution instruction aiming at the application transaction, calling a database transaction to carry out transaction processing on the application transaction data, and generating a transaction processing result.
2. The transaction processing method of claim 1, further comprising, prior to said obtaining the pending transaction data table:
when receiving a plurality of batches of logic transaction data of a function, storing the plurality of batches of logic transaction data into one logic transaction;
obtaining a plurality of logic transactions, numbering the logic transactions according to the difference of functions, and obtaining the transaction numbers;
And sequentially numbering each batch of the logic transaction data according to the writing sequence of each batch of the logic transaction data to obtain transaction sub-numbers.
3. The method of claim 2, wherein the step of respectively packaging each of the logical transactions and a plurality of batches of logical transaction data corresponding to each of the logical transactions according to the transaction numbers to obtain an application transaction and application transaction data corresponding to the application transaction includes:
merging the logic transactions corresponding to the same transaction number into one application transaction;
and merging the multiple batches of logic transaction data of the logic transactions corresponding to the same transaction number into the application transaction data.
4. A transaction method according to claim 3, wherein said invoking a database transaction to transact said application transaction data to generate a transaction result comprises:
taking the transaction sub-number as the execution priority of each batch of logic transaction data in the application transaction;
and calling the database transaction, and performing transaction processing on each batch of the logic transaction data in the application transaction data according to the execution priority of each batch of the logic transaction data to generate the transaction processing result.
5. The method for processing a transaction according to claim 1, wherein after said packaging processing is performed on each of said logical transactions and a plurality of batches of logical transaction data corresponding to each of said logical transactions according to said transaction numbers, respectively, obtaining an application transaction and application transaction data corresponding to the application transaction, further comprising:
creating a file database table and a memory database table, wherein the table structures of the file database table and the memory database table are kept consistent;
storing the application transaction and the application transaction data of the application transaction into the memory database table;
and synchronizing the memory database table to the file database table at regular time.
6. The method for processing a transaction according to claim 1, wherein after said packaging processing is performed on each of said logical transactions and a plurality of batches of logical transaction data corresponding to each of said logical transactions according to said transaction numbers, respectively, obtaining an application transaction and application transaction data corresponding to the application transaction, further comprising:
creating a file database table and a memory database table, wherein the table structures of the file database table and the memory database table are kept consistent;
And storing the application transaction and the application transaction data of the application transaction into the memory database table or the file database table.
7. The method of claim 5, wherein the invoking the database transaction to transact the application transaction data to generate a transaction result comprises:
when the transaction is a query and/or insert operation, performing a transaction on the application transaction data in the memory database table;
and when the transaction processing is deleting and/or updating operation, performing transaction processing on the application transaction data in the memory database table and the file database table.
8. A transaction processing device, comprising:
the system comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring a transaction data table to be processed, the transaction data table comprises a plurality of logic transactions and a plurality of batches of logic transaction data corresponding to the logic transactions, each logic transaction is configured with a transaction number, and the transaction number is used for distinguishing the functions realized by the logic transactions;
the packaging module is used for respectively packaging each logic transaction and a plurality of batches of logic transaction data corresponding to each logic transaction according to the transaction number to obtain an application transaction and application transaction data corresponding to the application transaction;
And the processing module is used for calling a database transaction to conduct transaction processing on the application transaction data in response to the execution instruction aiming at the application transaction, and generating a transaction processing result.
9. A computer device, the computer device comprising:
one or more processors;
a memory; and one or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the processor to implement the transaction method of any of claims 1 to 7.
10. A computer readable storage medium having stored thereon a computer program to be loaded by a processor for performing the steps of the transaction method of any of claims 1 to 7.
CN202311212791.XA 2023-09-19 2023-09-19 Transaction processing method, device, computer equipment and storage medium Pending CN117453698A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311212791.XA CN117453698A (en) 2023-09-19 2023-09-19 Transaction processing method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311212791.XA CN117453698A (en) 2023-09-19 2023-09-19 Transaction processing method, device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN117453698A true CN117453698A (en) 2024-01-26

Family

ID=89593687

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311212791.XA Pending CN117453698A (en) 2023-09-19 2023-09-19 Transaction processing method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117453698A (en)

Similar Documents

Publication Publication Date Title
US10453010B2 (en) Computer device, method, and apparatus for scheduling business flow
CN107105009B (en) Job scheduling method and device for butting workflow engine based on Kubernetes system
CN110442560B (en) Log replay method, device, server and storage medium
CN110309161B (en) Data synchronization method and device and server
CN109325016B (en) Data migration method, device, medium and electronic equipment
US20230137119A1 (en) Method for replaying log on data node, data node, and system
CN112000649B (en) Method and device for synchronizing incremental data based on map reduce
US11748164B2 (en) FAAS distributed computing method and apparatus
CN111930489A (en) Task scheduling method, device, equipment and storage medium
CN112416654A (en) Database log replay method, device, equipment and storage medium
CN108108119B (en) Configuration method and device for extensible storage cluster things
CN113157411B (en) Celery-based reliable configurable task system and device
WO2012024435A2 (en) System and method for execution of high performance computing applications
WO2021082925A1 (en) Transaction processing method and apparatus
CN113238815A (en) Interface access control method, device, equipment and storage medium
CN117453698A (en) Transaction processing method, device, computer equipment and storage medium
CN112527497B (en) Serialized multithreaded data processing system
CN113342511A (en) Distributed task management system and method
CN109241027B (en) Data migration method, device, electronic equipment and computer readable storage medium
CN110908821A (en) Method, device, equipment and storage medium for task failure management
CN114510490B (en) Method and device for improving data insertion performance of database
CN114020357B (en) Starting method, device, system and medium of naminode node
CN117171419B (en) Content processing method, device, electronic apparatus, storage medium, and program product
US20230128133A1 (en) Distributed smart lock system
WO2024051738A1 (en) Data writing method and apparatus, and electronic device and storage medium

Legal Events

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