Transactional task processing method and device
Technical Field
The present application relates to the field of computer task processing technologies, and in particular, to a transactional task processing method and apparatus.
Background
With the development of computer information technology, more and more transactional tasks appear in distributed systems. The transactional task performs a series of operations on the database, either all or none of which are performed as an integral whole. When there are multiple transactional tasks concurrently executing, errors may occur in the results of the database operations. For example, while transactional task a performs ten plus 1 operations on the database and obtains the operation result, transactional task B performs ten minus 1 operations on the database, which may cause transactional task a to obtain an erroneous result due to the execution of transactional task B.
To solve the problem of concurrent execution of multiple transactional tasks, the prior art employs a database lock mechanism. The database lock mechanism constructs a database lock based on data in a database, and regulates concurrent execution of multiple transactional tasks through the database lock. That is, before the transaction type task starts, the system takes the service data in the database as the database lock, when a transaction type task arrives, the database lock is acquired first and then executed, after the transaction type task is finished, the database lock is released, and then other transaction type tasks can acquire the database lock again and execute the database lock.
Therefore, the database locking mechanism can solve the problem of concurrent execution of a plurality of transactional tasks and ensure the accuracy of data in the concurrent execution process of the plurality of transactional tasks. However, the database lock mechanism depends heavily on the service data of the database itself, and if there is no service data suitable as the database lock in the database, the database lock mechanism is difficult to use. In addition, after a transactional task acquires a database lock, if the transactional task executes very slowly, it may cause long waiting times for other transactional tasks.
Disclosure of Invention
The embodiment of the application provides a transactional task processing method and device, which are used for processing transactional tasks in a database.
The embodiment of the application adopts the following technical scheme:
a transactional task processing method, comprising:
receiving a current transactional task;
inquiring the state attribute of a lock object of a database corresponding to the current transaction task according to the current transaction task, if the state attribute is displayed as completion, executing the current transaction task, and modifying the state attribute into operation, wherein the lock object comprises the state attribute of the execution state of the transaction task;
and submitting the current transaction type task according to the execution condition of the current transaction type task.
Preferably, the method further comprises:
building a record in a distributed system, the record containing at least a field for determining a transactional task state attribute;
and mapping the record to a database of the distributed system as a lock object corresponding to the database.
Preferably, the lock object is stored in a database corresponding to the lock object in the distributed system, or in another database other than the database corresponding to the lock object in the distributed system.
Preferably, the lock object further includes a task identifier attribute, a start time attribute, and a timeout threshold attribute, where the task identifier attribute is used to record a task identifier of a most recently executed task, the start time attribute is used to record a time when the current transactional task is executed, and the timeout threshold attribute is the maximum time that a processing task can be used, and the method further includes:
and if the state attribute shows that the task is running, judging whether the execution time of the task recorded by the task identifier of the lock object is greater than the value of the overtime threshold attribute, and if so, executing the current transaction type task.
Preferably, the method further comprises:
judging whether the execution time of the current transaction type task is larger than the value of the overtime threshold attribute, if so, rolling back the current transaction type task; if not, submitting the current transaction type task according to the execution condition.
Preferably, the execution time of the task is specifically a difference between a current time and a time recorded by the start time attribute of the lock object when the task starts.
Preferably, the lock object further includes an overtime attribute and an overtime threshold attribute, the overtime attribute is used to record the number of times that the transaction type task is executed overtime, the overtime threshold attribute refers to the maximum value of the overtime attribute, and before submitting the current transaction type task according to the execution condition, the method further includes:
judging whether the execution time of the current transaction type task is larger than the value of the overtime threshold attribute, if so, rolling back the current transaction type task and increasing the value of the overtime number attribute; if not, submitting the current transaction type task according to the execution condition.
Preferably, the value of the attribute for increasing the number of times of timeout is specifically to add 1 to the value of the attribute for increasing the number of times of timeout.
Preferably, the method further comprises:
and judging whether the value of the overtime time attribute is greater than the value of the overtime time threshold attribute, if so, increasing the value of the overtime threshold attribute, and adjusting the value of the overtime time attribute to 0.
Preferably, the value of the timeout threshold attribute is specifically multiplied by 2.
Preferably, the method further comprises: and judging whether the current transactional task has errors, if so, rolling back the current transactional task.
A transactional task processing apparatus, comprising:
receiving unit, judging unit, lock object unit, execution unit and submitting unit, wherein:
the system comprises a receiving unit, a processing unit and a processing unit, wherein the receiving unit is used for receiving a processing request of a current transaction type task to a database, and the current transaction type task refers to a transaction type task for processing the database;
the judging unit is used for judging the lock object unit and judging the size;
the system comprises an object locking unit, a task identification subunit and a state subunit, wherein the object locking unit is used for adjusting the concurrent execution of multiple tasks in a database and comprises a task identification subunit and a state subunit, and the state attribute of the state subunit comprises operation and completion;
the execution unit is used for executing the current transaction type task when the judgment unit judges that the state attribute of the state subunit of the lock object unit is finished;
and the submitting unit is used for submitting the current transaction type task according to the execution condition.
Preferably, the lock object unit further includes a start time subunit and a timeout threshold subunit, where the start time subunit is configured to record time when the current transaction type task is executed, the timeout threshold subunit is configured to set a maximum time for processing a task, and when the determining unit determines that the state attribute of the state subunit of the lock object unit is running: the judging unit judges whether the execution time of the task recorded by the task identifier subunit of the object locking unit is greater than the value of the timeout threshold subunit, if so, the executing unit executes the current transaction type task.
Preferably, the lock object unit further comprises:
the system comprises an overtime frequency subunit and an overtime frequency threshold subunit, wherein the overtime frequency subunit is used for recording the overtime frequency of task execution, the overtime frequency threshold subunit is used for setting the maximum value of an overtime frequency attribute, and when the submission unit submits the current transaction type task: the judging unit judges whether the execution time of the current transaction type task is larger than the value of the overtime threshold subunit, if so, the value of the overtime frequency subunit is increased, and the submitting unit rolls back the current transaction type task; if not, the submitting unit submits the current transaction type task.
The embodiment of the application adopts at least one technical scheme which can achieve the following beneficial effects:
when the transactional task is processed, the problem of concurrent execution of the transactional task is solved by using the lock object provided by the application, and the problem that a database lock mechanism depends on service data of a database in the prior art is solved because the lock object does not depend on the service data in the database. In addition, at least one embodiment of the present application solves the problem of long waiting time of other transactional tasks under the condition that the transactional task is executed slowly by setting the timeout threshold attribute in the lock object.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the application and together with the description serve to explain the application and not to limit the application. In the drawings:
fig. 1 is a schematic flowchart of a transactional task processing method provided in embodiment 1 of the present application;
fig. 2 is a schematic flowchart of a transactional task processing method provided in embodiment 2 of the present application;
fig. 3 is a schematic flowchart of a transactional task processing method provided in embodiment 3 of the present application;
fig. 4 is a schematic flowchart of a transactional task processing method provided in embodiment 4 of the present application;
fig. 5 is a schematic flowchart of a transactional task processing method provided in embodiment 5 of the present application;
fig. 6 is a schematic structural diagram of a transactional task processing device according to embodiment 6 of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the technical solutions of the present application will be described in detail and completely with reference to the following specific embodiments of the present application and the accompanying drawings. It should be apparent that the described embodiments are only some of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The technical solutions provided by the embodiments of the present application are described in detail below with reference to the accompanying drawings.
Example 1
Embodiment 1 provides a method for transactional task processing in a system. The specific flow diagram of the method is shown in fig. 1, and the method comprises the following steps:
step 101: a current transactional task is received.
The distributed system receives a current transactional task. In a distributed system, when a computer needs to perform an indivisible series of operations on a database, it needs to send a task to the distributed system. Here, the whole of such an indivisible series of operations is referred to as a current transactional task, which is a transactional task for processing a database.
The payment system comprises a plurality of transactional tasks, a distributed system executes the tasks at regular time according to a set time rule, and the distributed system starts the processing flow of the task when the time point of executing a certain task is up to the present according to the set time rule.
Step 102: lock objects are built in a distributed system and then stored.
Building a record in a distributed system, the record containing at least a field for determining a transactional task state attribute; and mapping the record to a database of the distributed system as a lock object corresponding to the database.
And constructing a record in the distributed system, wherein the record at least comprises one field, and the field is used for defining the attribute, and then mapping the record to a database of the distributed system to be used as a lock object corresponding to the database.
In this embodiment, a record is constructed in the distributed system, the constructed record is used as a lock object, a mapping relationship is established between the lock object and the database, and then the lock object is stored. The constructed record at least comprises a state field, and the state field is used for defining state attributes. Multiple different fields may be included in the record for different attributes, such that the distributed lock implements different functions.
In particular, the constructed record may include a task identification field for defining task identification attributes and a status field for defining status attributes. In this way, the constructed lock object contains a task identification attribute and a state attribute.
Since the lock object is constructed directly by creating a record in the distributed system and is not dependent on the business data in the corresponding database, the lock object can be stored in the corresponding database of the distributed system or other databases of the distributed system during storage.
It should be noted that, when the order between step 102 and step 101 in this embodiment is interchanged, the implementation of the technical effect in this embodiment is not affected. That is, during the process of processing the task, the lock object may be constructed in the distributed system first, and then the current transactional task is received.
Step 103: and inquiring the state attribute of the lock object of the database corresponding to the current transaction task according to the current transaction task, and executing step 104 if the state attribute is displayed as completion, wherein the lock object comprises the state attribute of the execution state of the transaction task.
After receiving the task request of the current transaction type task, the distributed system queries the state attribute of the lock object. The state attribute of the lock object can be two types, one is completion (FINISH), which indicates that the lock object is in an idle state; the other is Run (RUNNING), which indicates that the lock object is in a locked state. If the query is complete, then execution begins at step 104. The lock object contains a state attribute for displaying the execution state of the lock object
Step 104: and executing the current transaction type task, and modifying the state attribute into operation.
When the state attribute of the lock object is shown as complete, the current transactional task is executed, and since the current transactional task already occupies the lock object, the state attribute of the lock object is changed to run.
In particular, errors often occur during the execution of a task, which may be caused by the task itself or by external factors. For example: when the transfer task is processed, if the account amount of the sender is not enough, a task error is caused, and the task error is caused by the task itself; if network interruption or power failure occurs in the transfer process, task errors can be caused, and the task errors are caused by external reasons. In order to prevent database errors caused by errors in the task execution process, step 1041 is added in the task execution process.
Step 1041: and judging whether the current transactional task has errors in the process of executing the current transactional task, and if so, rolling back the current transactional task.
And in the execution process of the current transaction type task, judging whether an error occurs, if so, rolling back the current transaction type task, namely returning the database to the state attribute before the current transaction type task is executed, and changing the state attribute of the lock into the lock completion state attribute.
Step 105: and submitting the current transaction type task according to the execution condition of the current transaction type task.
And if the current transaction type task completes all the operations without errors, submitting the current transaction type task and changing the state attribute of the lock object into completion.
By adopting the method provided by the embodiment 1, the lock object is constructed in the distributed system, and the concurrent execution of the transactional task is controlled through the state attribute of the lock object, so that the problem that the database lock mechanism in the prior art is difficult to use because no business data suitable for being used as a database lock exists when aiming at a non-relational database is solved.
Example 2
Embodiment 2 provides a transactional task processing method for processing a transactional task. The specific flow diagram of the method is shown in fig. 2, and the method comprises the following steps:
step 201: a current transactional task is received.
Step 202: and querying the state attribute of the lock object of the database corresponding to the current transactional task according to the current transactional task, executing step 2021 if the state attribute is displayed as complete, and executing step 2022 if the state attribute is displayed as running.
The lock object may include a task identifier attribute, a state attribute, a start time attribute, and a timeout threshold attribute, where the state attribute is used to display an operating state of the lock object, the start time attribute is used to record a time when the current transactional task is executed, the timeout threshold attribute is used to set a maximum time for processing a task, and the task identifier is used to uniquely represent a task. The state attribute of the lock object is inquired according to the current transaction type task processing request, and two situations may occur to the state attribute of the lock object, so that two different operation flows are generated. When the state attribute of the lock object is shown as complete, perform step 2021; step 2022 is performed when the state property of the lock object is shown as running.
Step 2021: and executing the current transaction type task, recording the task identifier and the current time of the current transaction type task, and modifying the state attribute to be running.
Step 2022: and judging whether the execution time of the previous task is greater than the value of the overtime threshold attribute, if so, executing the current transactional task, and recording the task identifier and the current time of the current transactional task, wherein the previous task refers to the transactional task recorded by the task identifier of the lock object before the current transactional task is executed.
The lock object provided in step 202, step 2021, and step 2022 may include four attributes, namely, a task identifier attribute, a state attribute, a start time attribute (startTime) and a timeout threshold attribute (overtime minutethreshhold), where the task identifier attribute is used to record a task identifier of a recently executed task, the state attribute is used to display an execution state of the lock, which represents whether the lock is idle, the start time attribute is used to record a time when the current transactional task starts to execute, and the timeout threshold attribute is the longest time that the processing task can be used.
After receiving the current transaction type task, the distributed system queries the state attribute of the lock object, if the state attribute of the lock object is found to be completed, the distributed system starts to execute the current transaction type task, records the task identifier carried by the current transaction type task in the task identifier attribute of the lock object, records the current time in the start time attribute, and changes the state attribute of the lock object into operation; if the state attribute of the lock object is found to be running, the execution time of the previous task needs to be compared with the value of the overtime threshold attribute, if the execution time of the previous task is greater than the value of the overtime threshold attribute, the current transaction type task is directly executed, the task identifier carried by the current transaction type task is recorded in the task identifier attribute of the lock, and meanwhile, the current time is recorded in the starting time attribute. The current time refers to the current displayed time of the system, the execution time of the task refers to the time of the task, and the specific calculation method comprises the following steps: the difference between the current time and the start time recorded by the start time attribute of the lock object at the start of the task.
Step 203: and submitting the current transaction type task according to the execution condition.
According to the method provided by the embodiment, the lock object is constructed in the distributed system, and the concurrent execution of the transactional task is controlled through the state attribute of the lock object, so that the problem that a database lock mechanism in the prior art is difficult to use due to the fact that no business data suitable for being used as a database lock exists when aiming at a non-relational database is solved; in addition, in this embodiment, by setting the start time attribute and the timeout threshold attribute in the lock object, after receiving the current transactional task, it can be determined whether the previous task is timeout, and the current transactional task is directly executed under the condition that the previous task is timeout, so that the problem of long-time waiting of other transactional tasks caused when the transactional task is slowly executed is solved.
Example 3
In embodiment 2, it is mentioned that the current transactional task is submitted according to an execution condition, and in fact before the current transactional task is submitted, the embodiment may further include determining whether an execution time of the current transactional task is greater than a value of the timeout threshold attribute. Thus, example 3 of the present application was constituted, and the steps of example 3 of the present application were the same as those of example 2 except for step 203. Referring to fig. 3, step 203 of embodiment 2 is changed in this embodiment to:
step 3031: and judging whether the execution time of the current transactional task is larger than the value of the overtime threshold attribute, if so, executing step 3032, and otherwise, executing step 3033.
Step 3032: rolling back the current transactional task.
Step 3033: and submitting the current transactional task.
At the end of the current transactional task execution, whether rolling back or committing, the present embodiment may also include changing the state attribute of the lock to completion.
By adopting the method provided by the embodiment 3, the following beneficial effects can be obtained: firstly, a lock object is constructed in a system, and the concurrent execution of a transaction type task is controlled through the state attribute of the lock object, so that the problem that a database lock mechanism in the prior art is difficult to use because no business data suitable for being used as a database lock exists when aiming at a non-relational database is solved; secondly, in this embodiment, by setting the start time attribute and the timeout threshold attribute in the lock object, after receiving the current transactional task, it can be determined whether the previous task is timeout, and the current transactional task is directly executed under the condition that the previous task is timeout, so that the problem of long-time waiting of other transactional tasks caused by slow execution of the transactional task is solved; thirdly, before the present transactional task is submitted, the present embodiment determines whether the present transactional task is submitted by determining whether the execution time of the present transactional task is greater than the value of the timeout threshold attribute, thereby preventing the problem of an error in updating the database when multiple tasks are executed concurrently.
Example 4
Embodiment 4 provides a transactional task processing method for processing a transactional task. The specific flow diagram of the method is shown in fig. 4, and the method comprises the following steps:
step 401: a current transactional task processing request is received.
Step 402: and querying the state attribute of the lock object of the database corresponding to the current transactional task according to the current transactional task, if the state attribute is displayed as completion, executing the step 4021, and if the state attribute is displayed as operation, executing the step 4022.
Step 4021: and executing the current transaction type task, recording the task identifier and the current time of the current transaction type task, and modifying the state attribute to be running.
Step 4022: and judging whether the execution time of the previous task is overtime, if so, executing the current transaction type task, and recording the task identifier and the current time of the current transaction type task.
In this embodiment, before querying the state attribute of the lock object of the database corresponding to the current transactional task according to the current transactional task in step 402, the method may also include constructing and storing the lock object;
the lock object provided in step 202, step 2021, and step 2022 may include a task identifier attribute, a state attribute, a start time attribute, a timeout threshold attribute, a timeout number attribute, and a timeout number threshold attribute, where the state attribute is used to display an operating state of the lock, the start time attribute is used to record a time when the task starts to be executed, the timeout threshold attribute is used to set a maximum time for processing the task, the timeout number attribute is used to record a number of times the task is executed, the timeout number threshold attribute is used to set a maximum value of the timeout number attribute, and the task identifier is used to uniquely represent the task;
as shown in table 1, the attribute information of the lock object in this embodiment includes six attributes, i.e., a task identifier attribute, a state attribute, a start time attribute, a timeout threshold attribute, a timeout time attribute (timeOutTimes) and a timeout time threshold attribute (timeoutthreshhold).
Table 1: attribute information for lock objects
taskName
|
startTime
|
overTimeMinutesThresHold
|
timeOutTimes
|
timeOutThresHold
|
status |
In the attributes of the lock object in this embodiment, the task identifier attribute is used to record a task identifier of a recently executed task, the state attribute displays an operating state of the lock object, which represents whether the lock object is idle, the start time attribute is used to record a time when a current transactional task starts to be executed, the timeout threshold attribute is used to set a maximum time that a processing task can use, the timeout number attribute is used to record a number of times that a task in a system is executed overtime, and the timeout number threshold attribute is used to set a maximum value of the timeout number attribute.
Step 4031: and judging whether the execution time of the current transaction type task is larger than the value of the overtime threshold attribute.
Step 4032: and if so, rolling back the current transaction type task and increasing the value of the overtime time attribute.
Step 4033: if not, submitting the current transaction type task.
When the execution time of the current transaction type task is judged to be greater than the value of the timeout threshold attribute, the value of the timeout frequency attribute can be increased in various modes, and particularly, when the execution time of the current transaction type task is judged to be greater than the value of the timeout threshold attribute, the task is rolled back, the value of the timeout frequency attribute is added with 1, and the timeout frequency attribute can be used for counting the total number of times of the execution task of the system within a period of time.
By adopting the method provided by the embodiment 4, the following beneficial effects can be obtained: firstly, a lock object is constructed in a system, and the concurrent execution of a transaction type task is controlled through the state attribute of the lock object, so that the problem that a database lock mechanism in the prior art is difficult to use because no business data suitable for being used as a database lock exists when aiming at a non-relational database is solved; secondly, in this embodiment, by setting the start time attribute and the timeout threshold attribute in the lock object, after receiving the current transactional task, it can be determined whether the previous task is timeout, and the current transactional task is directly executed under the condition that the previous task is timeout, so that the problem of long-time waiting of other transactional tasks caused by slow execution of the transactional task is solved; thirdly, before submitting the current transactional task, the embodiment determines whether the current transactional task is submitted by judging whether the execution time of the current transactional task is greater than the value of the timeout threshold attribute, so that the problem of error in updating the database when multiple tasks are executed concurrently is solved; fourthly, when the executed task is overtime, the lock object provided by the embodiment is used for counting the overtime times of the system operation process by changing the value of the overtime times attribute of the lock.
Example 5
In embodiment 4, the value of the timeout number attribute is increased, and after the value of the timeout number attribute is increased, the embodiment may further include comparing the value of the timeout number attribute with the value of the timeout number threshold attribute, so as to adjust the value of the timeout threshold attribute. Thus, example 5 of the present application was constructed, and compared with example 4, example 5 of the present application has the same steps except for steps 504 and 505. Referring to FIG. 5:
step 504: and judging whether the value of the timeout attribute is larger than that of the timeout threshold attribute.
Step 505: if yes, increasing the value of the timeout threshold attribute, and adjusting the value of the timeout number attribute to 0.
When the timeout attribute is greater than the value of the timeout threshold attribute within a period of time (e.g., a day), it means that the set value of the timeout threshold attribute is too small, which causes frequent timeout of task execution and affects the efficiency of task execution, and therefore, the value of the timeout threshold attribute needs to be increased. One preferred way to increase the value of the timeout threshold attribute is to multiply the value of the timeout threshold attribute by 2.
By adopting the method provided by the embodiment 5, the following beneficial effects can be obtained: firstly, a lock object is constructed in a system, and the concurrent execution of a transaction type task is controlled through the state attribute of the lock object, so that the problem that a database lock mechanism in the prior art is difficult to use because no business data suitable for being used as a database lock exists when aiming at a non-relational database is solved; secondly, in this embodiment, by setting the start time attribute and the timeout threshold attribute in the lock object, after receiving the current transactional task, it can be determined whether the previous task is timeout, and the current transactional task is directly executed under the condition that the previous task is timeout, so that the problem of long-time waiting of other transactional tasks caused by slow execution of the transactional task is solved; thirdly, before submitting the current transactional task, the embodiment determines whether the current transactional task is submitted by judging whether the execution time of the current transactional task is greater than the value of the timeout threshold attribute, so that the problem of error in updating the database when multiple tasks are executed concurrently is solved; fourthly, when the executed task is overtime, the lock object provided by the embodiment is used for counting the overtime times of the system operation process by changing the value of the overtime time attribute of the lock; fourthly, the lock object provided by the embodiment can judge whether timeout is frequent, and the efficiency of executing the task is improved by increasing the value of the timeout threshold attribute under the condition of frequent timeout.
Example 6
Based on the same inventive concept, embodiment 6 provides a transactional task processing apparatus for processing a transactional task. As shown in fig. 6, the apparatus 600 includes: a receiving unit 601, a judging unit 602, a lock object unit 603, an executing unit 604 and a submitting unit 605, wherein:
a receiving unit 601, configured to receive a request for processing a database by a current transactional task;
a determining unit 602, configured to determine a lock object unit and determine a size;
the lock object unit 603 is used for adjusting the concurrent execution of multiple tasks in the database, and comprises a task identification subunit 6031 and a state subunit 6032, and the state attribute of the state subunit comprises operation and completion;
an executing unit 604, configured to execute the current transaction type task when the determining unit determines that the state attribute of the state subunit of the lock object unit is complete;
a committing unit 605, configured to commit the current transactional task according to an execution situation.
After the receiving unit receives a processing request of a current transaction type task to the database, the judging unit judges the state attribute of the state subunit of the object locking unit, if the state attribute is displayed to be completed, the executing unit executes the current transaction type task, and finally, the submitting unit submits the current transaction type task according to the execution condition of the executing unit to the task.
In particular, the apparatus may further include a monitoring unit 606 for monitoring whether the task is in error during the execution of the task, and if the task is monitored to be in error, the task is rolled back directly by the execution unit 604.
In particular, the lock object unit may further include a start time subunit 6033 and a timeout threshold subunit 6034, where the start time subunit 6033 is configured to record a time when the current transactional task is executed, the timeout threshold subunit 6034 is configured to set a maximum time for which a processing task can be used, and when the determination unit 602 determines that the state attribute of the state subunit 6032 of the lock object unit 603 is run: the determining unit 602 determines whether the execution time of the task recorded by the task identification subunit 6031 of the lock object unit 603 is greater than the value of the timeout threshold subunit 6034, and if so, the execution unit executes the current transaction type task, and the start time subunit 6033 records the time when the current transaction type task is executed.
In particular, the lock object unit may further include: a start time subunit 6033, a timeout threshold subunit 6034, a timeout number subunit 6035, and a timeout number threshold subunit 6036, where the start time subunit 6033 is configured to record time when the current-transaction-type task is executed, the timeout threshold subunit 6034 is configured to set the longest time during which a processing task can be used, the timeout number subunit 6035 is configured to record the number of times a task is executed overtime, and the timeout number threshold subunit 6036 is configured to set the maximum value of the timeout number attribute, and when the commit unit 605 commits the current-transaction-type task: the determining unit 602 determines whether the execution time of the current transactional task is greater than the value of the timeout threshold subunit 6034, if yes, the value of the timeout number subunit 6035 is increased, and the committing unit 605 rolls back the current transactional task; if not, then commit unit 605 commits the current transactional task. In addition, after increasing the value of the timeout number subunit 6035, the determination unit 602 may also determine whether the value of the timeout number subunit 6035 is greater than the value of the timeout number threshold subunit 6036, and if so, increase the value of the timeout threshold subunit 6034 and modify the value of the timeout number subunit 6035 to 0.
With the transactional task processing device provided in embodiment 6, because the use of the locking unit of the transactional task processing device does not depend on the service data of the database, the problem that the database locking mechanism in the prior art depends on the service data of the database is overcome.
The above are merely examples of the present application and are not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.