CN116225630A - Transaction processing method, apparatus, electronic device, storage medium, and program product - Google Patents
Transaction processing method, apparatus, electronic device, storage medium, and program product Download PDFInfo
- Publication number
- CN116225630A CN116225630A CN202310233405.9A CN202310233405A CN116225630A CN 116225630 A CN116225630 A CN 116225630A CN 202310233405 A CN202310233405 A CN 202310233405A CN 116225630 A CN116225630 A CN 116225630A
- Authority
- CN
- China
- Prior art keywords
- transaction
- database
- data manipulation
- executed
- manipulation language
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/466—Transaction processing
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/21—Design, administration or maintenance of databases
-
- Y—GENERAL 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
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE 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/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Databases & Information Systems (AREA)
- Data Mining & Analysis (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)
Abstract
The embodiment of the application provides a transaction processing method, a transaction processing device, electronic equipment, a storage medium and a program product, and relates to the technical field of databases. The method comprises the following steps: determining a database isolation level and determining a database transaction opening mode; if the isolation level of the database and the opening mode of the database transaction accord with the first preset condition, determining the operation type of at least one executed data manipulation language; a target database transaction to be committed is generated based on the determined type of operation and the executed data manipulation language, and the target database transaction is committed. In the transaction processing method provided by the application, when the preset condition is met, the type of the executed data manipulation language is judged, and the way of submitting the executed data manipulation language is selected according to different types, so that the database transaction meeting the preset condition can submit and release resources in time, and the waste of database resources caused by long-time occupation is avoided.
Description
Technical Field
The present application relates to the field of database technologies, and in particular, to a transaction processing method, an apparatus, an electronic device, a storage medium, and a computer program product.
Background
With the development of database technology, the manner of submitting database transactions and synchronizing data between replicas is increasingly important to the efficiency of the database. A transaction of a database is a mechanism, an operation sequence, comprising a set of operation commands to the database. Some operations of the database can be automatically submitted, namely each statement is executed as a transaction, manual submission of a user is not needed, the statements are independent, and the data operation of the user can be saved in time.
The existing method for solving the problem that the database transaction is not submitted for a long time is to suspend the transaction after the idle transaction is overtime, but the overtime time of the transaction is not easy to evaluate, the transaction occupies resources on one copy for a long time and is not released, the use and the stability of the database system are affected, and the waste of the database resources is caused.
Disclosure of Invention
The embodiment of the application aims to solve the problem that the database transaction occupies resources for a long time and is not submitted automatically. The technical scheme is as follows:
in a first aspect, the present application provides a transaction processing method, including:
determining a database isolation level and determining a database transaction opening mode;
if the database isolation level and the database transaction opening mode meet a first preset condition, determining the operation type of at least one executed data manipulation language;
generating a target database transaction to be committed based on the determined operation type and the executed data manipulation language, and committing the target database transaction.
In an optional embodiment of the first aspect, the first preset condition includes:
the database isolation level is read committed, and the database transaction opening mode is implicit opening and non-automatic commit.
In an alternative embodiment of the first aspect, the generating the target database transaction to be committed based on the determined operation type and the executed data manipulation language includes:
and if the operation types of the executed at least one data manipulation language are all read-only query operation types, taking the executed data manipulation language as a target database transaction to be submitted.
In an alternative embodiment of the first aspect, the generating the target database transaction to be committed based on the determined operation type and the executed data manipulation language includes:
if the executed at least one data manipulation language comprises a writing operation type, continuing to execute the data manipulation language to be executed until a second preset condition is met.
In an optional embodiment of the first aspect, the second preset condition includes:
the method comprises the steps that data manipulation language is not executed currently, and the interval time between the current time and the execution time of the last data manipulation language is greater than or equal to a preset duration;
the method further comprises the steps of:
closing a session channel, rolling back the database transaction, and releasing database resources; wherein the rollback refers to a state that is restored to before the transaction is executed.
In a second aspect, there is provided a transaction processing apparatus, the apparatus comprising:
the first determining module is used for determining the isolation level of the database and determining the transaction opening mode of the database;
the second determining module is used for determining the operation type of the executed at least one data manipulation language if the database isolation level and the database transaction opening mode meet a first preset condition;
and the submitting module is used for generating a target database transaction to be submitted based on the determined operation type and the executed data manipulation language, and submitting the target database transaction.
In a third aspect, there is provided an electronic device comprising a memory, a processor and a computer program stored on the memory, characterized in that the processor executes the computer program to carry out the steps of the method according to any of the first aspects of the present application.
In a sixth aspect, there is provided a computer readable storage medium having stored thereon a computer program, wherein the computer program, when executed by a processor, implements the transaction method according to any of the first aspects of the present application.
In a seventh aspect, a computer program product is provided, comprising a computer program, characterized in that the computer program, when executed by a processor, implements the transaction method according to any of the first aspects of the present application.
The beneficial effects that technical scheme that this application embodiment provided brought are:
according to the transaction processing method, the operation type of at least one executed data manipulation language is determined by determining the isolation level of the database and determining the opening mode of the database transaction, wherein the isolation level of the database and the opening mode of the database meet a first preset condition; a target database transaction to be committed is generated based on the determined type of operation and the executed data manipulation language, and the target database transaction is committed. In the transaction processing method provided by the application, when the preset condition is met, the type of the executed data manipulation language is judged, and the way of submitting the executed data manipulation language is selected according to different types, so that the database transaction meeting the preset condition can submit and release resources in time, and the waste of database resources caused by long-time occupation is avoided.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings that are required to be used in the description of the embodiments of the present application will be briefly described below.
Fig. 1 is an application scenario schematic diagram of a transaction processing method provided in an embodiment of the present application;
FIG. 2 is a schematic flow chart of a transaction processing method according to an embodiment of the present application;
FIG. 3 is a flow chart of an example of a transaction method according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of a transaction processing device according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of an electronic device to which the transaction processing method according to the embodiment of the present application is applicable.
Detailed Description
Embodiments of the present application are described below with reference to the drawings in the present application. It should be understood that the embodiments described below with reference to the drawings are exemplary descriptions for explaining the technical solutions of the embodiments of the present application, and the technical solutions of the embodiments of the present application are not limited.
As used herein, the singular forms "a", "an", "the" and "the" are intended to include the plural forms as well, unless expressly stated otherwise, as understood by those skilled in the art. It will be further understood that the terms "comprises" and "comprising," when used in this application, specify the presence of stated features, information, data, steps, operations, and components, but do not preclude the presence or addition of other features, information, data, steps, operations, components, and/or groups thereof, that may be included in the present application. It will be understood that when an element is referred to as being "connected" or "coupled" to another element, it can be directly connected or coupled to the other element or intervening elements may be present. Further, "connected" or "coupled" as used herein may include wirelessly connected or wirelessly coupled. The term "and/or" as used herein indicates that at least one of the items defined by the term, e.g., "a and/or B" may be implemented as "a", or as "B", or as "a and B".
For the purpose of making the objects, technical solutions and advantages of the present application more apparent, the embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
Several terms which are referred to in this application are first introduced and explained:
data manipulation language (Data Manipulation Language, DML): some simple operations are performed on the data in the database, such as insert, delete, update, select, etc.
There are 4 levels of isolation for database transactions, from low to high, read uncommitted, read committed, reorderable Read, serialized, respectively.
Read Committed (Read Committed): one transaction can only see changes made by already committed transactions, the query results are not repeatable, allowing the same select query to return different results.
The data manipulation languages of read-only query operations are: SELECT statement (without FOR UPDATE).
The data manipulation languages of the write operation are: INSERT, UPDATE, DELETE, SELECT FOR UPDATE (select for UPDATE).
In the prior art, there are two general solutions to the problem that database transactions are not submitted for a long time, but the problem that the timeout configuration value is not well evaluated and the database resources are wasted for a long time exists.
Aiming at least one technical problem or the place needing improvement in the related art, the application provides a transaction processing method, a device, electronic equipment, a storage medium and a computer program product, wherein the transaction processing method provided by the application determines the operation type of at least one executed data manipulation language by determining a database isolation level and determining a database transaction opening mode, and the database isolation level and the database transaction opening mode meet a first preset condition; a target database transaction to be committed is generated based on the determined type of operation and the executed data manipulation language, and the target database transaction is committed. In the transaction processing method provided by the application, when the preset condition is met, the type of the executed data manipulation language is judged, and the way of submitting the executed data manipulation language is selected according to different types, so that the database transaction meeting the preset condition can submit and release resources in time, and the waste of database resources caused by long-time occupation is avoided.
The technical solutions of the embodiments of the present application and technical effects produced by the technical solutions of the present application are described below by describing several exemplary embodiments. It should be noted that the following embodiments may be referred to, or combined with each other, and the description will not be repeated for the same terms, similar features, similar implementation steps, and the like in different embodiments.
Fig. 1 is a schematic application scenario diagram of a transaction processing method according to an embodiment of the present application, where an application environment may include a terminal 101 installed with an application program for processing database transactions.
Specifically, when the database operation is performed in the terminal 101, the above-mentioned transaction processing method may be used for executing and submitting a database transaction, that is, determining the isolation level of the database and the opening mode of the database transaction, if the first preset condition is met, determining the operation of the executed data manipulation language, if the operation type meets the second preset condition, that is, if the time interval of the execution time of the data manipulation language on the current idle time distance is greater than the preset time, closing the session channel, rolling back the database transaction, and releasing the database resource.
In the application scenario, in an application program operating a database in the terminal 101, using the transaction processing method, the executed database data manipulation language meeting the preset conditions is used, and a submitting mode is selected according to the type; in other embodiments, the database operation may be performed in a server, and the application scenario described above is only an example and is not limited to the application scenario of the transaction processing method of the present application.
Those skilled in the art will appreciate that a terminal (which may also be referred to as a user terminal or user device) may be, but is not limited to, a smart phone, tablet, notebook, desktop computer, smart voice interaction device (e.g., a smart speaker), wearable electronic device (e.g., a smart watch), vehicle-mounted terminal, smart home appliance (e.g., a smart television), AR/VR device, aircraft, etc. The embodiment of the invention can be applied to various scenes, including but not limited to cloud technology, artificial intelligence, intelligent transportation, auxiliary driving and the like.
The server may include a server installed with a capability to handle database operations. The server may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server or a server cluster for providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDNs (Content Delivery Network, content delivery networks), basic cloud computing services such as big data and artificial intelligent platforms, and the like. The terminal may be a smart phone (such as an Android mobile phone, an iOS mobile phone, etc.), a tablet computer, a notebook computer, a digital broadcast receiver, an MID (Mobile Internet Devices, mobile internet device), a PDA (personal digital assistant), a desktop computer, a smart home appliance, a vehicle-mounted terminal (such as a vehicle-mounted navigation terminal, a vehicle-mounted computer, etc.), a smart speaker, a smart watch, etc., and the terminal and the server may be directly or indirectly connected through wired or wireless communication manners, but are not limited thereto. The embodiment of the invention can be applied to various scenes, including but not limited to cloud technology, artificial intelligence, intelligent transportation, auxiliary driving and the like. And in particular, the method can be determined based on actual application scene requirements, and is not limited herein.
In some possible embodiments, taking an example that an execution body is a database operation program in a terminal as an example, the embodiment of the present application provides a transaction processing method, as shown in fig. 2, may include the following steps:
s201, determining a database isolation level and determining a database transaction opening mode.
The database isolation level may include: read uncommitted, read committed, repeated reads, and serialized, in this embodiment of the application, the database isolation level includes read committed, i.e., one transaction can only see changes made by transactions that have committed.
Specifically, the triggering conditions for determining the isolation level of the database and the opening mode of the database transaction may be: the two conditions are determined at intervals of a preset time, or the two conditions are determined at the beginning of an operation of detecting the commit of a transaction.
S202, if the isolation level of the database and the opening mode of the database transaction meet a first preset condition, determining the operation type of at least one executed data manipulation language.
The first preset condition comprises that the isolation level of the database is that reading is submitted, and the opening mode of the database transaction is implicit opening and non-automatic submitting. The operation types of the data manipulation language include: read-only query operations and write operations.
Specifically, when the database isolation level is that the read is submitted and the database transaction opening mode is that both conditions of implicit opening and non-automatic submitting are satisfied, the operation type of at least one data manipulation language which is executed is judged.
In a specific implementation, the number of executed data manipulation languages may be one or more, and executed means that data manipulation languages that have been executed but not submitted when determining the operation type, for example, ABC three data manipulation languages have been executed when determining the operation type after determining the database isolation level and the database transaction opening mode, and then the operation type of ABC three data manipulation languages is determined.
S203, generating a target database transaction to be submitted based on the determined operation type and the executed data manipulation language, and submitting the target database transaction.
Wherein the target database transaction may include at least one data manipulation language; the committed procedures are in terms of database transactions, which may include one or more data manipulation languages.
In the specific implementation process, when the operation types are all read-only query operation types, the executed data manipulation language is generated into a target database transaction to be submitted, and if the write operation type appears in the operation types, the executed data manipulation language is not submitted; for example, there are three data manipulation languages that have been executed, ABC, where B is a write operation type and both A and B are read-only query operation types, and ABC cannot be generated as a target database transaction commit.
In some possible embodiments, the first preset condition in S202 includes:
(1) The database isolation level is read committed, and the database transaction opening mode is implicit opening and non-automatic commit.
When the database transaction opening mode is non-automatic submission, the opening of the transaction is implicit opening, and the database transaction processing method is needed to be used; when the database transaction opening mode is automatic opening, namely explicit opening, the database transaction processing method is not carried out; for example, a user explicitly opens a transaction using the BEGIN or START TRANSACION statement, and the database transaction method described above is not used even if read committed and non-automated commit conditions are met.
Specifically, the order of determining the isolation level of the database and the opening mode of the database transaction is not required, but two preset conditions are required to be met simultaneously.
In the implementation process, when the subsequent transaction commit operation is performed under the condition that the first preset condition is met, if at least one of the database isolation level and the database transaction opening mode is detected to be changed, the judgment and commit of the data manipulation language of the subsequent execution are not performed.
In some possible embodiments, generating the target database transaction to be committed in the step S203 based on the determined operation type and the executed data manipulation language includes:
(1) And if the operation types of the executed at least one data manipulation language are all read-only query operation types, taking the executed data manipulation language as a target database transaction to be submitted.
Wherein, when the operation types of the executed data manipulation languages are all read-only query operation types, the target database transaction may include one or more data manipulation languages.
In a specific implementation process, under the condition that a first preset condition is met, when judging the operation type for the first time, a plurality of executed data manipulation languages of read-only query operation types can exist, and then the plurality of executed data manipulation languages are generated into a target database transaction to be submitted; if a data manipulation language is executed after the first submission, the data manipulation language is of a read-only query operation, and the data manipulation language can be generated into a target database transaction for submission, namely, one data manipulation language is one database transaction.
In some possible embodiments, generating the target database transaction to be committed in the step S203 based on the determined operation type and the executed data manipulation language includes:
(1) If the executed at least one data manipulation language comprises a writing operation type, continuing to execute the data manipulation language to be executed until a second preset condition is met.
Specifically, when the number of data manipulation languages that have been executed is plural, the above-described method is executed as long as one of the data manipulation language operation types is a write operation type.
For example, from the last transaction commit, if the first executed data manipulation language is of a write operation type, the second and later executed data manipulation languages do not commit the transaction if the second preset condition is not satisfied; or, from the last transaction commit, the first preset condition is not met, the executed data manipulation languages have AB two data manipulation languages and are not committed, A is a read-only query operation type and B is a write operation type when judging the operation type, and the executed data manipulation languages and the later executed data manipulation languages are not processed until the second preset condition is met.
In some possible embodiments, the second preset condition may include:
the method comprises the steps that data manipulation language is not executed currently, and the interval time between the current time and the execution time of the last data manipulation language is greater than or equal to a preset duration;
the transaction processing method further comprises the following steps:
(1) Closing a session channel, rolling back the database transaction, and releasing database resources;
wherein the rollback refers to a state that is restored to before the transaction is executed.
Specifically, the time of the last data manipulation language execution is recorded, and the interval time is determined according to the time in the current system and the time of the last data manipulation language execution. Presetting a database transaction timeout duration, namely the preset duration, closing a session channel of a user when the interval time is greater than or equal to the preset duration, stopping a current transaction and releasing database resources.
In the specific implementation process, if the interval time is longer than the preset time length, closing a session channel of the user, rolling back the transaction to a state before executing the transaction, and releasing database resources; the user finds that the session channel has been closed due to a database transaction timeout when the user issues a database request after the session channel is closed.
In a specific implementation process, the second preset condition may also include receiving a submission instruction of the user; the user's commit instruction may be that the user executes a database transaction commit statement to commit the transaction, or that the user commits the transaction by clicking a commit button.
In a specific implementation process, after a commit instruction of a user is received, an executed data manipulation language is taken as a target database transaction according to the commit instruction of the user, the transaction can be considered to be started from the last time the transaction is completed, the transaction is stopped when the commit instruction of the user is received, and the executed data manipulation language can be considered to be submitted together as one transaction in one transaction.
In the above embodiment, by determining the database isolation level and determining the database transaction opening mode, if the database isolation level and the database transaction opening mode meet the first preset condition, determining the operation type of the executed at least one data manipulation language; a target database transaction to be committed is generated based on the determined type of operation and the executed data manipulation language, and the target database transaction is committed. In the transaction processing method provided by the application, when the preset condition is met, the type of the executed data manipulation language is judged, and the way of submitting the executed data manipulation language is selected according to different types, so that the database transaction meeting the preset condition can submit and release resources in time, and the waste of database resources caused by long-time occupation is avoided.
For a clearer understanding of the transaction methods described in embodiments of the present application, further details are set forth below in connection with examples.
In one example, the transaction method of the present application, as shown in fig. 3, may include:
determining the current database isolation level and a database transaction opening mode, wherein the database isolation level is achieved by both implicit opening and non-automatic opening when reading is submitted and the database transaction opening mode is achieved by both conditions, and judging the operation type of the data manipulation language which is executed since the last time of submitting is completed; if the operation types of the data manipulation languages are all read-only query operations, the executed data manipulation languages are used as a database transaction, and the transaction is submitted.
If the data manipulation language with the operation type of writing operation exists in the executed data manipulation languages, the currently executed data manipulation language is not submitted, the timeout duration is preset, whether the interval time between the current time and the last data manipulation language execution time exceeds the preset duration is judged, if the interval time is greater than or equal to the preset duration, a session channel of a user is closed, the transaction is rolled back, and database resources are released.
According to the transaction processing method, the database isolation level is determined, the database transaction opening mode is determined, and if the database isolation level and the database transaction opening mode meet the first preset condition, the operation type of at least one executed data manipulation language is determined; a target database transaction to be committed is generated based on the determined type of operation and the executed data manipulation language, and the target database transaction is committed. In the transaction processing method provided by the application, when the preset condition is met, the type of the executed data manipulation language is judged, and the way of submitting the executed data manipulation language is selected according to different types, so that the database transaction meeting the preset condition can submit and release resources in time, and the waste of database resources caused by long-time occupation is avoided.
An embodiment of the present application provides a transaction processing apparatus, as shown in fig. 4, the apparatus 40 may include: a first determination module 401, a second determination module 402, and a submit module 403, wherein,
a first determining module 401, configured to determine a database isolation level, and determine a database transaction opening manner;
a second determining module 402, configured to determine an operation type of the executed at least one data manipulation language if the database isolation level and the database transaction opening manner meet a first preset condition;
a commit module 403, configured to generate a target database transaction to be committed based on the determined operation type and the executed data manipulation language, and commit the target database transaction.
In the transaction processing device provided by the application, by determining the isolation level of the database and determining the opening mode of the database transaction, determining the operation type of at least one executed data manipulation language if the isolation level of the database and the opening mode of the database transaction meet a first preset condition; a target database transaction to be committed is generated based on the determined type of operation and the executed data manipulation language, and the target database transaction is committed. In the transaction processing method provided by the application, when the preset condition is met, the type of the executed data manipulation language is judged, and the way of submitting the executed data manipulation language is selected according to different types, so that the database transaction meeting the preset condition can submit and release resources in time, and the waste of database resources caused by long-time occupation is avoided.
An embodiment of the present application provides an electronic device, including a memory, a processor, and a computer program stored on the memory, where the processor executes the computer program to implement steps of a transaction processing method, and compared with the related art, the steps of the transaction processing method may be implemented: when the non-automatic submitting and the database isolation level is that reading is submitted, the submitting mode can be rapidly determined according to the type of the data manipulation language and the transaction where the data manipulation language is located is submitted, the resources can be rapidly released, and the waste caused by long-time occupation of the database resources is avoided.
In an alternative embodiment, an electronic device is provided, as shown in fig. 5, the electronic device 5000 shown in fig. 5 includes: a processor 5001 and a memory 5003. The processor 5001 is coupled to the memory 5003, e.g., via bus 5002. Optionally, the electronic device 5000 may further include a transceiver 5004, the transceiver 5004 may be used for data interaction between the electronic device and other electronic devices, such as transmission of data and/or reception of data, etc. Note that, in practical applications, the transceiver 5004 is not limited to one, and the structure of the electronic device 5000 is not limited to the embodiment of the present application.
The processor 5001 may be a CPU (Central Processing Unit ), general purpose processor, DSP (Digital Signal Processor, data signal processor), ASIC (Application Specific Integrated Circuit ), FPGA (Field Programmable Gate Array, field programmable gate array) or other programmable logic device, transistor logic device, hardware components, or any combination thereof. Which may implement or perform the various exemplary logic blocks, modules, and circuits described in connection with this disclosure. The processor 5001 may also be a combination of computing functions, e.g., including one or more microprocessor combinations, a combination of a DSP and a microprocessor, etc.
The Memory 5003 may be, but is not limited to, ROM (Read Only Memory) or other type of static storage device capable of storing static information and instructions, RAM (Random Access Memory ) or other type of dynamic storage device capable of storing information and instructions, EEPROM (Electrically Erasable Programmable Read Only Memory ), CD-ROM (Compact Disc Read Only Memory, compact disc Read Only Memory) or other optical disk storage, optical disk storage (including compact disc, laser disc, optical disc, digital versatile disc, blu-ray disc, etc.), magnetic disk storage media, other magnetic storage devices, or any other medium that can be used to carry or store computer programs and that can be Read by a computer.
The memory 5003 is for storing a computer program for executing embodiments of the present application, and is controlled for execution by the processor 5001. The processor 5001 is operative to execute computer programs stored in the memory 5003 to implement the steps illustrated in the foregoing method embodiments.
Among them, electronic devices include, but are not limited to: there is a terminal for database services.
Embodiments of the present application provide a computer readable storage medium having a computer program stored thereon, where the computer program, when executed by a processor, may implement the steps and corresponding content of the foregoing method embodiments.
The embodiments of the present application also provide a computer program product, which includes a computer program, where the computer program can implement the steps of the foregoing method embodiments and corresponding content when executed by a processor.
The terms "first," "second," "third," "fourth," "1," "2," and the like in the description and in the claims of this application and in the above-described figures, if any, are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the present application described herein may be implemented in other sequences than those illustrated or otherwise described.
It should be understood that, although the flowcharts of the embodiments of the present application indicate the respective operation steps by arrows, the order of implementation of these steps is not limited to the order indicated by the arrows. In some implementations of embodiments of the present application, the implementation steps in the flowcharts may be performed in other orders as desired, unless explicitly stated herein. Furthermore, some or all of the steps in the flowcharts may include multiple sub-steps or multiple stages based on the actual implementation scenario. Some or all of these sub-steps or phases may be performed at the same time, or each of these sub-steps or phases may be performed at different times, respectively. In the case of different execution time, the execution sequence of the sub-steps or stages may be flexibly configured according to the requirement, which is not limited in the embodiment of the present application.
The foregoing is merely an optional implementation manner of the implementation scenario of the application, and it should be noted that, for those skilled in the art, other similar implementation manners based on the technical ideas of the application are adopted without departing from the technical ideas of the application, and also belong to the protection scope of the embodiments of the application.
Claims (9)
1. A method of transaction processing, comprising:
determining a database isolation level and determining a database transaction opening mode;
if the database isolation level and the database transaction opening mode meet a first preset condition, determining the operation type of at least one executed data manipulation language;
generating a target database transaction to be committed based on the determined operation type and the executed data manipulation language, and committing the target database transaction.
2. The transaction method according to claim 1, wherein the first preset condition includes:
the database isolation level is read committed, and the database transaction opening mode is implicit opening and non-automatic commit.
3. The transaction processing method of claim 1, wherein the generating a target database transaction to commit based on the determined type of operation and the executed data manipulation language comprises:
and if the operation types of the executed at least one data manipulation language are all read-only query operation types, taking the executed data manipulation language as a target database transaction to be submitted.
4. The transaction processing method of claim 1, wherein the generating a target database transaction to commit based on the determined type of operation and the executed data manipulation language comprises:
if the executed at least one data manipulation language comprises a writing operation type, continuing to execute the data manipulation language to be executed until a second preset condition is met.
5. The transaction method according to claim 4, wherein the second preset condition includes:
the method comprises the steps that data manipulation language is not executed currently, and the interval time between the current time and the execution time of the last data manipulation language is greater than or equal to a preset duration;
the method further comprises the steps of:
closing a session channel, rolling back the database transaction, and releasing database resources; wherein the rollback refers to a state that is restored to before the transaction is executed.
6. A transaction processing device, comprising:
the first determining module is used for determining the isolation level of the database and determining the transaction opening mode of the database;
the second determining module is used for determining the operation type of the executed at least one data manipulation language if the database isolation level and the database transaction opening mode meet a first preset condition;
and the submitting module is used for generating a target database transaction to be submitted based on the determined operation type and the executed data manipulation language, and submitting the target database transaction.
7. An electronic device comprising a memory, a processor and a computer program stored on the memory, characterized in that the processor executes the computer program to implement the steps of the method of any one of claims 1 to 5.
8. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the transaction method according to any of claims 1 to 5.
9. A computer program product comprising a computer program, characterized in that the computer program, when executed by a processor, implements the steps of the method according to any one of claims 1 to 5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310233405.9A CN116225630A (en) | 2023-03-10 | 2023-03-10 | Transaction processing method, apparatus, electronic device, storage medium, and program product |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310233405.9A CN116225630A (en) | 2023-03-10 | 2023-03-10 | Transaction processing method, apparatus, electronic device, storage medium, and program product |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116225630A true CN116225630A (en) | 2023-06-06 |
Family
ID=86578547
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310233405.9A Pending CN116225630A (en) | 2023-03-10 | 2023-03-10 | Transaction processing method, apparatus, electronic device, storage medium, and program product |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116225630A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118193088A (en) * | 2024-05-14 | 2024-06-14 | 天津南大通用数据技术股份有限公司 | Transaction submission control method and device, electronic equipment and storage medium |
-
2023
- 2023-03-10 CN CN202310233405.9A patent/CN116225630A/en active Pending
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118193088A (en) * | 2024-05-14 | 2024-06-14 | 天津南大通用数据技术股份有限公司 | Transaction submission control method and device, electronic equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2021180025A1 (en) | Message processing method and apparatus, electronic device and medium | |
CN106844014B (en) | Method and device for realizing suspension prevention of distributed transactions | |
CN104065636B (en) | Data processing method and system | |
CN110018884B (en) | Distributed transaction processing method, coordination device, database and electronic equipment | |
CN110377369B (en) | Method, device and computer storage medium for running small program | |
US9170837B2 (en) | Transaction concurrent execution control system, method and program for carrying out a control of concurrently executing a transaction, including measuring execution time from starting to ending of transaction execution | |
US8898126B1 (en) | Method and apparatus for providing concurrent data insertion and updating | |
WO2019094499A1 (en) | System and method for committing and rolling back database requests | |
CN110222046B (en) | List data processing method, device, server and storage medium | |
CN108647102B (en) | Service request processing method and device of heterogeneous system and electronic equipment | |
CN111367948B (en) | Data processing method and device, electronic equipment and computer readable storage medium | |
CN111596864A (en) | Method, device, server and storage medium for data delayed deletion | |
CN111782679A (en) | Method and device for supervising data processing process, computer equipment and storage medium | |
CN116225630A (en) | Transaction processing method, apparatus, electronic device, storage medium, and program product | |
CN108021464B (en) | Bottom-pocketing processing method and device for application response data | |
CN109522187B (en) | Method and device for quickly extracting state information | |
CN111405015B (en) | Data processing method, device, equipment and storage medium | |
CN109740027B (en) | Data exchange method, device, server and storage medium | |
CN111240810B (en) | Transaction management method, device, equipment and storage medium | |
CN113986941A (en) | Transaction batch processing method and device | |
US20150379548A1 (en) | Method and System for Data Processing | |
CN109582330B (en) | Data model upgrading method, device, equipment and readable storage medium | |
CN112948410A (en) | Data processing method, device, equipment and medium | |
CN112711602A (en) | Running method and device of storage process, database system and storage medium | |
CN110874246A (en) | Module loading method, system and equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |