CN109829678B - Rollback processing method and device and electronic equipment - Google Patents

Rollback processing method and device and electronic equipment Download PDF

Info

Publication number
CN109829678B
CN109829678B CN201711181632.2A CN201711181632A CN109829678B CN 109829678 B CN109829678 B CN 109829678B CN 201711181632 A CN201711181632 A CN 201711181632A CN 109829678 B CN109829678 B CN 109829678B
Authority
CN
China
Prior art keywords
rollback
task
workflow
work
execution
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201711181632.2A
Other languages
Chinese (zh)
Other versions
CN109829678A (en
Inventor
谢家森
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Alibaba Group Holding Ltd
Original Assignee
Alibaba Group Holding 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 Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201711181632.2A priority Critical patent/CN109829678B/en
Publication of CN109829678A publication Critical patent/CN109829678A/en
Application granted granted Critical
Publication of CN109829678B publication Critical patent/CN109829678B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The application discloses a rollback processing method, comprising the following steps: acquiring a rollback request initiated for a workflow; determining at least one rollback task corresponding to the work task in the execution state of the workflow and at least one rollback execution sequence of the rollback task according to a rollback mapping relation of a pre-configured work task and the rollback task; terminating execution of the work task in the execution state; and executing the rollback tasks corresponding to the work tasks in the execution state according to the rollback execution sequence. According to the rollback processing method, the rollback process of the workflow is realized through the jump from the work task to the rollback task and the execution of the rollback task, so that the flexibility is higher, the realization of the rollback process is more convenient and quick, and the time consumption is shorter.

Description

Rollback processing method and device and electronic equipment
Technical Field
The application relates to the technical field of computers, in particular to a rollback processing method. The application also relates to a rollback processing device and electronic equipment.
Background
In a workflow system, the execution of a workflow (part of a business process or the automation of the whole business process in a computer application environment) often needs to be split into a plurality of tasks to be completed in a matched manner, but in the execution process of the workflow task, due to factors such as external intervention, system self-checking abnormality and the like, in many occasions, a mechanism for stopping the execution of a subsequent task aiming at the currently executed workflow is required, the workflow is required to be capable of rapidly and effectively stopping the execution by itself, and a rollback mechanism for rollback the executed task is also required.
The rollback mechanism for the workflow provided at present, as shown in fig. 1, is to realize the rollback interface corresponding to each task while each task of the workflow a is realized, when the workflow a receives an execution request, each task and the rollback operation corresponding to each task are initialized, after initialization is completed, the tasks are sequentially executed according to the front-to-back order, when an instruction for canceling execution of the workflow a is received, the rollback operation corresponding to the executed task is sequentially executed according to the reverse order from the back-to-front way, and the rollback execution result of the workflow a is obtained after execution is completed. However, in the rollback mechanism provided in the prior art, a corresponding rollback interface needs to be implemented for each task of a workflow, so that a rollback method of each task of the workflow is ensured to be obtained in the rollback process, the rollback operation development configuration has a large task quantity, meanwhile, flexibility is also lacking, and multiple similar rollback operations may need to be implemented for multiple similar tasks of one workflow; in addition, the rollback process of the workflow sequentially executes rollback operations corresponding to executed tasks in a reverse order from back to front, and under the condition that the tasks of the workflow are relatively more, the rollback process needs to execute more rollback operations to obtain rollback execution results, so that the time consumption is relatively long.
Disclosure of Invention
The application provides a rollback processing method to solve the problems of lack of flexibility and long time consumption in the prior art.
The application also relates to a rollback processing device and electronic equipment.
The application provides a rollback processing method, which comprises the following steps:
acquiring a rollback request initiated for a workflow;
determining at least one rollback task corresponding to the work task in the execution state of the workflow and at least one rollback execution sequence of the rollback task according to a rollback mapping relation of a pre-configured work task and the rollback task;
terminating execution of the work task in the execution state;
and executing the rollback tasks corresponding to the work tasks in the execution state according to the rollback execution sequence.
Optionally, before the step of obtaining the rollback request initiated for the workflow is performed, the following steps are performed:
initializing a work task of the workflow according to a pre-acquired execution request for the workflow.
Optionally, after the step of initializing the workflow according to the pre-acquired execution request for the workflow is executed, the following steps are executed:
For the work tasks of the workflow, the following operations are performed:
and judging whether the work task meets a preset rollback condition, if so, initializing the rollback task corresponding to the work task, and writing the initialized work task and the rollback task corresponding to the work task into the rollback mapping relation.
Optionally, the rollback condition includes: the execution time of the work task is greater than or equal to a preset time threshold.
Optionally, the initializing the work task of the workflow according to the pre-acquired execution request for the workflow includes:
initializing the execution sequence of the work tasks of the workflow.
Optionally, before the step of determining at least one rollback task corresponding to the work task in the execution state of the workflow is executed, the following operations are executed:
and judging whether the work task of which the workflow is in an execution state is configured with a corresponding rollback task, if so, executing at least one rollback task step corresponding to the work task of which the workflow is determined to be in the execution state.
Optionally, if the judging result of the step of judging whether the work task in the execution state of the workflow is configured with the corresponding rollback task is that the work task in the execution state is not configured with the corresponding rollback task, executing the work task in the execution state, and executing the following operations after the execution of the work task in the execution state is completed:
Judging whether a corresponding rollback task is configured for a next work task to be executed after the work task in the execution state of the workflow is executed according to the execution sequence, and if so, executing the following operations:
determining at least one rollback task corresponding to the work task to be executed, and at least one second rollback execution sequence of the rollback task, terminating execution of the work task of the workflow, and executing the rollback task corresponding to the work task to be executed according to the second rollback execution sequence.
Optionally, the rollback task includes: at least one rollback operation.
Optionally, the initializing the rollback task corresponding to the work task includes: and configuring the rollback operation contained in the rollback link corresponding to the work task and the rollback execution sequence of the rollback operation contained in the rollback link.
Optionally, executing the rollback task corresponding to the work task in the execution state according to the rollback execution sequence is implemented in the following manner:
and jumping to the first rollback operation contained in the rollback link corresponding to the work task in the execution state, and executing all rollback operations contained in the rollback link in turn according to the rollback execution sequence.
Optionally, the rollback operation is stored in a preset data storage unit, and is accessed through a rollback configuration interface configured by the data storage unit;
and when the rollback operation contained in the rollback link corresponding to the work task of the workflow is configured, the rollback operation matched with the work task of the workflow is read from the data storage unit by calling the rollback configuration interface, the rollback operation is configured by combining the business logic data of the work task, the rollback execution sequence of the rollback operation contained in the rollback link is configured, and the rollback operation contained in the rollback link corresponding to the configured work task of the workflow is written into the rollback mapping relation.
Optionally, if no rollback operation corresponding to the work task of the workflow exists in the data storage unit, a rollback operation corresponding to the work task is created, and the created rollback operation is registered and submitted to the data storage unit.
Optionally, the rollback operation stored in the data storage unit has a configuration dimension attribute, and when the rollback configuration interface is called to read the rollback operation matched with the work task from the data storage unit, the rollback operation with the configuration dimension consistent with the matching dimension of the work flow is configured from the read configuration dimension according to the matching dimension of the work flow;
Wherein the configuration dimension comprises at least one of: service type, service domain, and workflow attributes.
Optionally, the rollback processing method is implemented based on a preset database management platform, the database management platform is deployed in a cloud computing environment and is used for managing and maintaining a database implemented in the cloud computing environment, the workflow is submitted to the database management platform in a distributed task flow mode, and by submitting an execution request and/or rollback request of the workflow to the database management platform, the database management platform performs service processing and/or rollback processing on the submitted workflow.
The application also provides a rollback processing device, comprising:
a rollback request acquisition unit, configured to acquire a rollback request initiated for a workflow;
the rollback task determining unit is used for determining at least one rollback task corresponding to the work task in the execution state of the workflow and at least one rollback execution sequence of the rollback task according to a rollback mapping relation between the pre-configured work task and the rollback task;
the work task termination unit is used for terminating the execution of the work task in the execution state;
And the rollback task execution unit is used for executing the rollback task corresponding to the work task in the execution state according to the rollback execution sequence.
Optionally, the rollback processing device operates based on a preset database management platform, the database management platform is deployed in a cloud computing environment and is used for managing and maintaining a database implemented in the cloud computing environment, the workflow is submitted to the database management platform in a distributed task flow mode, and by submitting an execution request and/or rollback request of the workflow to the database management platform, the database management platform performs service processing and/or rollback processing on the submitted workflow.
The application also provides an electronic device comprising:
a memory, and a processor;
the memory is for storing computer-executable instructions, and the processor is for executing the computer-executable instructions:
acquiring a rollback request initiated for a workflow;
determining at least one rollback task corresponding to the work task in the execution state of the workflow and at least one rollback execution sequence of the rollback task according to a rollback mapping relation of a pre-configured work task and the rollback task;
Terminating execution of the work task in the execution state;
and executing the rollback tasks corresponding to the work tasks in the execution state according to the rollback execution sequence.
According to the rollback processing method, rollback requests initiated by a workflow are acquired; determining at least one rollback task corresponding to the work task in the execution state of the workflow and at least one rollback execution sequence of the rollback task according to a rollback mapping relation of a pre-configured work task and the rollback task; terminating execution of the work task in the execution state; and executing the rollback tasks corresponding to the work tasks in the execution state according to the rollback execution sequence.
According to the rollback processing method, in the process of realizing rollback according to the rollback request initiated by the workflow, corresponding rollback tasks when the workflow is in an execution state and rollback execution sequences of the rollback tasks are determined according to the rollback mapping relation between the preconfigured work tasks and the rollback tasks, and the corresponding rollback tasks are executed according to the determined rollback execution sequences after the execution of the work tasks of the workflow is stopped, so that the rollback process of the workflow is realized. According to the rollback processing method, when rollback is realized during execution of the workflow, the rollback process of the workflow is realized through skip from the work task to the rollback task and execution of the rollback task on the basis of the rollback task corresponding to the work task of the workflow and the rollback execution sequence, so that the flexibility is higher, the realization of the rollback process is more convenient and rapid, and the time consumption is shorter.
Drawings
FIG. 1 is a schematic diagram of a rollback mechanism provided by the prior art;
FIG. 2 is a schematic diagram of one embodiment of a rollback process provided herein;
FIG. 3 is a schematic diagram of an embodiment of a rollback processing apparatus provided herein;
fig. 4 is a schematic diagram of an embodiment of an electronic device provided in the present application.
Detailed Description
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present application. This application is, however, susceptible of embodiment in many other ways than those herein described and similar generalizations can be made by those skilled in the art without departing from the spirit of the application and the application is therefore not limited to the specific embodiments disclosed below.
The application provides a rollback processing method, a rollback processing device and electronic equipment. The following detailed description, together with the drawings of the embodiments provided herein, respectively, describes the steps of the method one by one.
The embodiment of the rollback processing method provided by the application is as follows:
referring to fig. 2, a schematic diagram of an embodiment of a rollback process is shown.
Step 1, a rollback request initiated for a workflow is acquired.
The workflow in the embodiment of the application refers to automation of part or whole of a business process in a computer application environment, one workflow can be split into different work tasks, and the work tasks obtained after splitting are used for realizing corresponding functions of the workflow. As shown in fig. 2, the workflow a is functionally split into n work tasks: work task 1 to work task n.
In the implementation, before the rollback request initiated for the workflow is obtained in this step, an initialization operation for the workflow and an initialization operation for a rollback task corresponding to the work task are also required to be executed. The workflow initialization operation specifically comprises initializing any work of the workflow according to a pre-acquired execution request for the workflow, initializing the workflow, and initializing the execution sequence of the work tasks of the workflow. As shown in fig. 2, the workflow a is initialized, and the execution sequence of the n work tasks of the workflow a is initialized, where the initialized execution sequence is: and sequentially executing the work tasks 1 to n.
The initialization operation of the rollback task corresponding to the work task specifically comprises the following operation for each work task in all work tasks of the workflow: and judging whether the work task meets a preset rollback condition, if so, initializing the rollback task corresponding to the work task, and writing the initialized work task and the rollback task corresponding to the work task into the rollback mapping relation. The rollback condition refers to that the execution time of the work task is greater than or equal to a preset time threshold. By initializing the rollback tasks corresponding to the work tasks, rollback definition is realized for the key work tasks of the workflow, for example, the work tasks with longer execution time of the workflow are regarded as key works, rollback definition is realized for the key work tasks, and the realization mode is simpler. As in the workflow a shown in fig. 2, the execution time of the work task 2 and the work task 3 is relatively long among n work tasks of the workflow a, so that rollback definition is implemented for the work task 2 and the work task 3.
In practical applications, any one job task of the workflow, the corresponding rollback process does not necessarily involve one rollback operation, and multiple rollback operations may be required to cooperatively cooperate to jointly implement the rollback process. For this case, the rollback task described in the embodiments of the present application may also be a rollback link that is composed of at least one rollback operation. On the basis that the rollback task is a rollback link formed by at least one rollback operation, correspondingly, the initialization operation of the rollback task corresponding to the work task comprises the following steps: and configuring the rollback operation contained in the rollback link corresponding to the work task and the rollback execution sequence of the rollback operation contained in the rollback link.
As described above, the rollback task is a rollback link composed of at least one rollback operation, and if there are multiple rollback operations or a combination thereof for any one of the work tasks of the workflow, one or more rollback links composed of multiple rollback operations or a combination thereof according to the rollback execution order may be used as the rollback task of the work task for the work task. Therefore, any one of the work tasks of the workflow is not fixed in the corresponding rollback process, one work task can also realize rollback through any one rollback link among a plurality of rollback links, and rollback results of all the rollback links corresponding to the work task are the same, so that accuracy and uniqueness of the rollback results are ensured.
Workflow a as shown in fig. 2, wherein the rollback tasks of the work task 2 are: when the rollback link formed by the rollback operation 1 and the rollback operation 2 initializes the rollback task of the work task 2, not only the corresponding rollback operation 1 and the rollback operation 2, but also the execution sequence (rollback execution sequence) of the rollback operation 1 and the rollback operation 2 in the rollback process are initialized. The rollback task of the work task 3 is a rollback link formed by the rollback operations 3 alone, and only the rollback operations 3 need to be initialized.
In addition, in practical application, when each work task of the business requirement workflow can implement rollback in some special scenarios, the preset time threshold can be set to a smaller value by adjusting the value of the preset time threshold, so that all work tasks of the workflow can implement rollback definition.
The realization method is that when the rollback definition is realized for the work tasks of the workflow, the rollback definition is not necessarily realized for all the work tasks of the workflow, so that the corresponding relationship between the work tasks of the workflow and the corresponding rollback tasks is maintained by setting the rollback mapping relationship. Specifically, all the work tasks for realizing the rollback definition of the workflow and the rollback tasks corresponding to the work tasks for realizing the rollback definition are recorded in the rollback mapping relation.
For example, a rollback mapping table provided below:
workflow ID Job task ID Rollback operation ID
Workflow A Task 2 Rollback operation 1
Workflow A Task 3 Rollback operation 3
Workflow B Task 3 Rollback operation 1
Workflow B Work task 16 Rollback operation 2
Workflow C Task 8 Rollback operation 3
Workflow C Work task 10 Rollback operation 1
In contrast to fig. 2, in the table above, a work task 2 and a work task 3 for implementing rollback definition by the workflow a are recorded, and meanwhile, a rollback link formed by the rollback operation 1, which is the first rollback operation 1 in the rollback links (rollback operation 1- > rollback operation 2) corresponding to the work task 2, and the rollback operation 3 corresponding to the work task 3 are also recorded. Similarly, the above table also records the work tasks of the workflow B and the workflow C for realizing the rollback definition respectively, and the rollback links corresponding to the work tasks for realizing the rollback definition respectively.
In implementing rollback definition for work tasks of the workflow, rollback operations may be taken as the most basic unit to implement the rollback definition process, and the execution framework of these most basic rollback operations is abstracted: for the same rollback operation, in implementing rollback definitions for different workflows, the execution framework of the same rollback operation is the same, except that there is a difference in business logic data of rollback operations for different workflows (i.e., different businesses). Based on the idea, the sharing of rollback operations corresponding to the work tasks of the workflow can be realized, namely, the sharing of execution frames of the rollback operations is realized, and different business logic data are only required to be configured for the work tasks of different workflows, so that different rollback operations are prevented from being respectively developed for the workflows of different business types, and the realization cost for realizing rollback definition for the work tasks of the workflows is greatly reduced.
Specifically, in practical application, the rollback operation (i.e. the execution framework of the rollback operation) may be stored in a preset data storage unit, and accessed through a rollback configuration interface configured by the data storage unit; when the rollback operation contained in the rollback link corresponding to the work task of the workflow is configured, the rollback operation matched with the work task of the workflow is read from the data storage unit by calling the rollback configuration interface, the rollback operation is configured by combining the business logic data of the work task, the rollback execution sequence of the rollback operation contained in the rollback link is configured, and the rollback operation contained in the rollback link corresponding to the configured work task of the workflow is written into the rollback mapping relation.
However, in practical applications, new service types or service fields often occur, when rollback definitions are implemented for the workflows of these service types or service fields, it is inevitable that some workflow tasks (new service functions) are encountered, and no corresponding rollback operation exists in the data storage unit, and in this case, the rollback operation corresponding to the workflow task may be created, and the created rollback operation is registered and submitted to the data storage unit.
In addition, the rollback operation stored in the data storage unit also has a configuration dimension attribute, and when the rollback configuration interface is called to read the rollback operation matched with the work task from the data storage unit, the rollback operation with the configuration dimension consistent with the matching dimension of the work flow is configured from the read configuration dimension according to the matching dimension of the work flow; wherein the configuration dimension comprises at least one of: service type, service domain, and workflow attributes.
After the initialization operation for the workflow and the initialization operation for the rollback task corresponding to the work task of the workflow are realized, the work task of the workflow is executed on the basis, and in the process of executing the workflow, if the execution of the work task of the workflow is canceled due to business needs or other factors and the work task executed by the workflow needs to be rolled back, in the step, the rollback request initiated for the workflow is acquired.
And 2, determining at least one rollback task corresponding to the work task in the execution state of the workflow and at least one rollback execution sequence of the rollback task according to a rollback mapping relation of the pre-configured work task and the rollback task.
For example, work task 1 of workflow B, its corresponding rollback tasks include:
(1) The rollback link formed by the rollback operation 1 and the rollback operation 2 has the following rollback execution sequence: rollback operation 1- > rollback operation 2;
(2) The rollback link consisting of the rollback operation 1, the rollback operation 5 and the rollback task 6 is rolled back in the execution sequence as follows: rollback operation 1- > rollback operation 5- > rollback operation 6.
In a preferred implementation manner provided in this embodiment of the present application, in this step, according to a rollback mapping relationship between a pre-configured work task and a rollback task, determining at least one rollback task corresponding to the work task in an execution state of the workflow, and executing a rollback task judgment operation before at least one rollback execution sequence of the rollback task. The rollback task judging operation is specifically implemented as follows:
judging whether the work task of the work flow in the execution state is configured with a corresponding rollback task or not, namely judging whether the work task of the work flow in the execution state has realized rollback definition or not, if so, executing the step, determining the rollback mapping relation between the work task and the rollback task according to the pre-configuration, determining at least one rollback task corresponding to the work task of the work flow in the execution state and at least one rollback execution sequence of the rollback tasks;
If not, indicating that the work task of the work flow in the execution state does not realize rollback definition, executing the work task of the work flow in the execution state, waiting for the next work task configured with the corresponding rollback task, and performing the rollback process of the work flow based on the next work task configured with the corresponding rollback task.
Specifically, if the work task of the workflow in the current execution state is not configured with a corresponding rollback task, waiting for the next work task configured with the corresponding rollback task, and performing a rollback process of the workflow based on the next work task configured with the corresponding rollback task, wherein the rollback process is implemented specifically in the following manner:
executing the work task of the workflow in the execution state at present, and executing the following operations after the execution of the work task of the workflow in the execution state at present is completed: judging whether a corresponding rollback task is configured for a next work task to be executed after the work task in the execution state of the workflow is executed according to the execution sequence, and if so, executing the following operations: determining at least one rollback task corresponding to the work task to be executed, and at least one second rollback execution sequence of the rollback task, terminating execution of the work task of the workflow, and executing the rollback task corresponding to the work task to be executed according to the second rollback execution sequence.
If the job task 1 is rolled back when executing, as shown in fig. 2, the rolling back process of the job flow a cannot be realized because the job task 1 does not realize the rolling back definition, it needs to be determined whether the job task 2 to be executed realizes the rolling back definition, if the job task 2 to be executed already realizes the rolling back definition, the rolling back process of the job flow a is realized based on the rolling back link corresponding to the job task 2 to be executed after the job task 1 is executed. If the rollback definition is not realized by the to-be-executed work task 2, judging whether the rollback definition is realized by the to-be-executed work task 3, and if the rollback definition is realized by the to-be-executed work task 3, after the execution of the to-be-executed work task 2 is finished, realizing the rollback process of the workflow A based on the rollback link corresponding to the to-be-executed work task 3.
And step 3, terminating executing the work task in the executing state.
In this step, the execution of the work task of which the workflow is currently in an execution state is terminated. As shown in fig. 2, if the job task 2 is rolled back when executed, the execution of the job task 2 currently in the execution state of the job flow a is terminated on the basis that the job task 2 has implemented the rollback definition. If the rollback is performed when the work task 3 is executed, the execution of the work task 3 of which the workflow a is currently in an execution state is terminated on the basis that the rollback definition has been implemented by the work task 3.
And step 4, executing the rollback tasks corresponding to the work tasks in the execution state according to the rollback execution sequence.
And 2, determining at least one rollback task corresponding to the work task in the execution state of the workflow and at least one rollback execution sequence of the rollback task according to a rollback mapping relation between the work task and the rollback task which are pre-configured, wherein the step 3 is used for stopping the execution of the work task of the workflow. As described above, the rolling task of the work task is a rolling link formed by at least one rolling operation, and preferably, the step executes the rolling task corresponding to the work task in the execution state according to the rolling execution sequence, specifically refers to jumping to the first rolling operation included in the rolling link corresponding to the work task in the execution state, and executing all rolling operations included in the rolling link in sequence from the first rolling operation according to the rolling execution sequence.
As shown in fig. 2, in the workflow a, the rollback task corresponding to the work task 2 is a rollback link formed by the rollback operation 1 and the rollback operation 2, the rollback execution sequence is rollback operation 1- > rollback operation 2, if rollback is performed when the work task 2 is executed, and the first rollback operation in the rollback link corresponding to the work task 2 is skipped based on the execution of the termination work task 2: a rollback operation 1, a rollback operation 1 and a rollback operation 2 are sequentially performed from the rollback operation 1. The rollback task corresponding to the work task 3 is a rollback link formed by the rollback operations 3 alone, if the rollback is performed when the work task 3 is executed, the rollback operation 3 in the rollback link corresponding to the work task 3 is skipped and the rollback operation 3 is executed on the basis of stopping the execution of the work task 3.
In a specific implementation, the rollback processing method provided in the application may also be implemented based on a preset database management platform, where the database management platform is deployed in a cloud computing environment and is used to manage and maintain a database implemented in the cloud computing environment, for example, an RDS (Relational Database Service) cloud database management platform provided by the ori cloud is used to manage a relational database optimized or deployed in the cloud computing environment provided by the ori cloud, and in a process of performing service processing using the database management platform, a service party may use a service rollback service provided by the database management platform to implement a rollback process of a corresponding service or service function. Specifically, the service party submits the workflow to be processed to the database management platform in a distributed task flow mode, and the database management platform performs service processing on the workflow or rollback processing on the workflow according to the submitted execution request or rollback request by submitting the execution request or rollback request for the workflow to the database management platform.
In summary, according to the rollback processing method provided by the present application, in the process of implementing rollback according to the rollback request initiated for the workflow, according to the rollback mapping relationship between the pre-configured work task and the rollback task, the rollback task corresponding to the work task in the execution state of the workflow and the rollback execution sequence of the rollback task are determined, and after the execution of the work task of the workflow is stopped, the corresponding rollback task is executed according to the determined rollback execution sequence, thereby implementing the rollback process of the workflow. According to the rollback processing method, when rollback is realized during execution of the workflow, the rollback process of the workflow is realized through skip from the work task to the rollback task and execution of the rollback task on the basis of the rollback task corresponding to the work task of the workflow and the rollback execution sequence, so that the flexibility is higher, the realization of the rollback process is more convenient and rapid, and the time consumption is shorter.
The embodiment of a rollback processing device provided by the application is as follows:
in the foregoing embodiments, a rollback processing method is provided, and correspondingly, the present application further provides a rollback processing apparatus, which is described below with reference to the accompanying drawings.
Referring to fig. 3, a schematic diagram of an embodiment of a rollback processing apparatus is shown.
Since the apparatus embodiments are substantially similar to the method embodiments, the description is relatively simple, and reference should be made to the corresponding descriptions of the method embodiments provided above for relevant parts. The device embodiments described below are merely illustrative.
The application provides a rollback processing apparatus, comprising:
a rollback request acquiring unit 301, configured to acquire a rollback request initiated for a workflow;
a rollback task determining unit 302, configured to determine, according to a rollback mapping relationship between a pre-configured work task and a rollback task, at least one rollback task corresponding to a work task in an execution state of the workflow, and at least one rollback execution order of the rollback task;
a task termination unit 303, configured to terminate execution of the task in the execution state;
and the rollback task execution unit 304 is configured to execute the rollback task corresponding to the work task in the execution state according to the rollback execution order.
Optionally, the rollback processing device includes:
and the work task initializing unit is used for initializing the work task of the workflow according to the execution request of the workflow, which is acquired in advance.
Optionally, the rollback processing device includes:
the rollback condition judging unit is used for judging whether the work task meets a preset rollback condition, if so, initializing a rollback task corresponding to the work task, and writing the initialized work task and the rollback task corresponding to the initialized work task into the rollback mapping relation; and running the rollback condition judgment unit for the work task of the workflow.
Optionally, the rollback condition includes: the execution time of the work task is greater than or equal to a preset time threshold.
Optionally, the task initializing unit includes:
and the execution sequence initializing subunit is used for initializing the execution sequence of the work tasks of the workflow.
Optionally, the rollback processing device includes:
and the rollback judgment unit is used for judging whether the work task of which the workflow is in an execution state is configured with a corresponding rollback task, and if so, the rollback task determination unit 302 is operated.
Optionally, if the judging result output by the rollback judging unit is that the work task in the executing state is not configured with a corresponding rollback task, the first executing unit and the secondary rollback judging unit are operated;
the first execution unit is used for executing the work task in the execution state;
the secondary rollback judging unit is used for judging whether a work task to be executed, which is executed next after the work task in the execution state of the workflow is executed, is configured with a corresponding rollback task according to the execution sequence, and if so, the rollback executing subunit is operated; the rollback execution subunit is configured to determine at least one rollback task corresponding to the work task to be executed, and at least one second rollback execution sequence of the rollback task, terminate execution of the work task of the workflow, and execute the rollback task corresponding to the work task to be executed according to the second rollback execution sequence.
Optionally, the rollback task includes: at least one rollback operation.
Optionally, the initializing the rollback task corresponding to the work task includes:
and configuring the rollback operation contained in the rollback link corresponding to the work task and the rollback execution sequence of the rollback operation contained in the rollback link.
Optionally, the rollback task execution unit 304 includes:
and the jump execution subunit is used for jumping to the first rollback operation contained in the rollback link corresponding to the work task in the execution state, and sequentially executing all rollback operations contained in the rollback link according to the rollback execution sequence.
Optionally, the rollback operation is stored in a preset data storage unit, and is accessed through a rollback configuration interface configured by the data storage unit;
and when the rollback operation contained in the rollback link corresponding to the work task of the workflow is configured, the rollback operation matched with the work task of the workflow is read from the data storage unit by calling the rollback configuration interface, the rollback operation is configured by combining the business logic data of the work task, the rollback execution sequence of the rollback operation contained in the rollback link is configured, and the rollback operation contained in the rollback link corresponding to the configured work task of the workflow is written into the rollback mapping relation.
Optionally, if no rollback operation corresponding to the work task of the workflow exists in the data storage unit, a rollback operation corresponding to the work task is created, and the created rollback operation is registered and submitted to the data storage unit.
Optionally, the rollback operation stored in the data storage unit has a configuration dimension attribute, and when the rollback configuration interface is called to read the rollback operation matched with the work task from the data storage unit, the rollback operation with the configuration dimension consistent with the matching dimension of the work flow is configured from the read configuration dimension according to the matching dimension of the work flow;
wherein the configuration dimension comprises at least one of: service type, service domain, and workflow attributes.
Optionally, the rollback processing device operates based on a preset database management platform, the database management platform is deployed in a cloud computing environment and is used for managing and maintaining a database implemented in the cloud computing environment, the workflow is submitted to the database management platform in a distributed task flow mode, and by submitting an execution request and/or rollback request of the workflow to the database management platform, the database management platform performs service processing and/or rollback processing on the submitted workflow.
An embodiment of an electronic device provided in the present application is as follows:
in the foregoing embodiments, a rollback processing method is provided, and in addition, an electronic device for implementing the rollback processing method is provided, which is described below with reference to the accompanying drawings.
Referring to fig. 4, a schematic diagram of an electronic device provided in this embodiment is shown.
The embodiments of the electronic device provided in the present application are described more simply, and relevant portions will be referred to the corresponding descriptions of the embodiments of the rollback processing method provided above. The embodiments described below are merely illustrative.
The application provides an electronic device, comprising:
a memory 401 and a processor 402;
the memory 401 is configured to store computer executable instructions, and the processor 402 is configured to execute the computer executable instructions:
acquiring a rollback request initiated for a workflow;
determining at least one rollback task corresponding to the work task in the execution state of the workflow and at least one rollback execution sequence of the rollback task according to a rollback mapping relation of a pre-configured work task and the rollback task;
terminating execution of the work task in the execution state;
and executing the rollback tasks corresponding to the work tasks in the execution state according to the rollback execution sequence.
Optionally, before the acquiring is performed for the rollback request instruction initiated by the workflow, the processor 402 is further configured to execute the following computer executable instructions:
Initializing a work task of the workflow according to a pre-acquired execution request for the workflow.
Optionally, after the execution of the task instruction for initializing the workflow according to the pre-acquired execution request for the workflow, the processor 402 is further configured to execute the following computer-executable instructions:
for the work tasks of the workflow, the following operations are performed: and judging whether the work task meets a preset rollback condition, if so, initializing the rollback task corresponding to the work task, and writing the initialized work task and the rollback task corresponding to the work task into the rollback mapping relation.
Optionally, the rollback condition includes: the execution time of the work task is greater than or equal to a preset time threshold.
Optionally, the initializing the work task of the workflow according to the pre-acquired execution request for the workflow includes:
initializing the execution sequence of the work tasks of the workflow.
Optionally, before the executing of the at least one rollback task instruction corresponding to the work task for which the workflow is determined to be in the executing state, the processor 402 is further configured to execute the following computer executable instructions:
And judging whether the work task of which the workflow is in an execution state is configured with a corresponding rollback task, if so, executing at least one rollback task instruction corresponding to the work task of which the workflow is determined to be in the execution state.
Optionally, if the execution result of the corresponding rollback task instruction is no for the task to be executed, which is executed next after the task in the execution state is executed, the processor 402 is further configured to execute the following computer executable instructions:
executing the work task in the execution state, and executing the following operations after the execution of the work task in the execution state is completed:
judging whether a corresponding rollback task is configured for a next work task to be executed after the work task in the execution state of the workflow is executed according to the execution sequence, and if so, executing the following operations:
determining at least one rollback task corresponding to the work task to be executed, and at least one second rollback execution sequence of the rollback task, terminating execution of the work task of the workflow, and executing the rollback task corresponding to the work task to be executed according to the second rollback execution sequence.
Optionally, the rollback task includes: at least one rollback operation.
Optionally, the initializing the rollback task corresponding to the work task includes: and configuring the rollback operation contained in the rollback link corresponding to the work task and the rollback execution sequence of the rollback operation contained in the rollback link.
Optionally, executing the rollback task corresponding to the work task in the execution state according to the rollback execution sequence is implemented in the following manner:
and jumping to the first rollback operation contained in the rollback link corresponding to the work task in the execution state, and executing all rollback operations contained in the rollback link in turn according to the rollback execution sequence.
Optionally, the rollback operation is stored in a preset data storage unit, and is accessed through a rollback configuration interface configured by the data storage unit;
and when the rollback operation contained in the rollback link corresponding to the work task of the workflow is configured, the rollback operation matched with the work task of the workflow is read from the data storage unit by calling the rollback configuration interface, the rollback operation is configured by combining the business logic data of the work task, the rollback execution sequence of the rollback operation contained in the rollback link is configured, and the rollback operation contained in the rollback link corresponding to the configured work task of the workflow is written into the rollback mapping relation.
Optionally, if no rollback operation corresponding to the work task of the workflow exists in the data storage unit, a rollback operation corresponding to the work task is created, and the created rollback operation is registered and submitted to the data storage unit.
Optionally, the rollback operation stored in the data storage unit has a configuration dimension attribute, and when the rollback configuration interface is called to read the rollback operation matched with the work task from the data storage unit, the rollback operation with the configuration dimension consistent with the matching dimension of the work flow is configured from the read configuration dimension according to the matching dimension of the work flow;
wherein the configuration dimension comprises at least one of: service type, service domain, and workflow attributes.
Optionally, the processor 402 executes the computer executable instructions based on a preset database management platform, where the database management platform is deployed in a cloud computing environment and is used to manage and maintain a database implemented in the cloud computing environment, and the workflow is submitted to the database management platform in a distributed task flow manner, and by submitting an execution request and/or a rollback request of the workflow to the database management platform, the database management platform performs a service process and/or a rollback process on the submitted workflow.
While the preferred embodiment has been described, it is not intended to limit the invention thereto, and any person skilled in the art may make variations and modifications without departing from the spirit and scope of the present invention, so that the scope of the present invention shall be defined by the claims of the present application.
In one typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include volatile memory in a computer-readable medium, random Access Memory (RAM) and/or nonvolatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of computer-readable media.
Computer readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for a computer include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device. Computer readable media, as defined herein, does not include non-transitory computer readable media (transmission media), such as modulated data signals and carrier waves.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.

Claims (13)

1. A rollback processing method, comprising:
initializing a work task of a workflow according to a pre-acquired execution request for the workflow;
judging whether the work task meets a preset rollback condition, if so, initializing a rollback task corresponding to the work task, and writing the initialized work task and the rollback task corresponding to the work task into the rollback mapping relation;
acquiring a rollback request initiated for a workflow;
determining at least one rollback task corresponding to the work task in the execution state of the workflow and at least one rollback execution sequence of the rollback task according to a rollback mapping relation of a pre-configured work task and the rollback task;
Terminating execution of the work task in the execution state;
executing the rollback tasks corresponding to the work tasks in the execution state according to the rollback execution sequence;
wherein the rollback task comprises: at least one rollback link consisting of rollback operations;
the initializing the rollback task corresponding to the work task comprises the following steps: and configuring the rollback operation contained in the rollback link corresponding to the work task and the rollback execution sequence of the rollback operation contained in the rollback link.
2. The rollback processing method according to claim 1, characterized in that the rollback condition includes:
the execution time of the work task is greater than or equal to a preset time threshold.
3. The rollback processing method according to claim 1, wherein initializing the work task of the workflow according to the execution request for the workflow acquired in advance includes:
initializing the execution sequence of the work tasks of the workflow.
4. A rollback processing method according to any one of claims 1 to 3, wherein before the step of determining at least one rollback task corresponding to a work task in which the workflow is in an execution state is performed, the following operations are performed:
And judging whether the work task of which the workflow is in an execution state is configured with a corresponding rollback task, if so, executing at least one rollback task step corresponding to the work task of which the workflow is determined to be in the execution state.
5. The rollback processing method according to claim 4, wherein if the result of the step of determining whether the work task in the execution state of the workflow is configured with the corresponding rollback task is that the work task in the execution state is not configured with the corresponding rollback task, executing the work task in the execution state, and executing the following operations after the execution of the work task in the execution state is completed:
judging whether a corresponding rollback task is configured for a next work task to be executed after the work task in the execution state of the workflow is executed according to the execution sequence, and if so, executing the following operations:
determining at least one rollback task corresponding to the work task to be executed, and at least one second rollback execution sequence of the rollback task, terminating execution of the work task of the workflow, and executing the rollback task corresponding to the work task to be executed according to the second rollback execution sequence.
6. The rollback processing method according to claim 1, wherein the rollback tasks corresponding to the work tasks in the execution state are executed according to the rollback execution sequence, and are implemented in the following manner:
and jumping to the first rollback operation contained in the rollback link corresponding to the work task in the execution state, and executing all rollback operations contained in the rollback link in turn according to the rollback execution sequence.
7. The rollback processing method according to claim 1, wherein the rollback operation is stored in a preset data storage unit and is accessed through a rollback configuration interface configured by the data storage unit;
and when the rollback operation contained in the rollback link corresponding to the work task of the workflow is configured, the rollback operation matched with the work task of the workflow is read from the data storage unit by calling the rollback configuration interface, the rollback operation is configured by combining the business logic data of the work task, the rollback execution sequence of the rollback operation contained in the rollback link is configured, and the rollback operation contained in the rollback link corresponding to the configured work task of the workflow is written into the rollback mapping relation.
8. The rollback processing method according to claim 7, wherein if no rollback operation corresponding to a work task of the workflow exists in the data storage unit, a rollback operation corresponding to the work task is created, and the created rollback operation is registered and submitted to the data storage unit.
9. The rollback processing method according to claim 7, wherein the rollback operation stored in the data storage unit has a configuration dimension attribute, and when the rollback configuration interface is called to read the rollback operation matched with the work task from the data storage unit, the rollback operation with the configuration dimension consistent with the matching dimension of the work flow is configured according to the matching dimension of the work flow;
wherein the configuration dimension comprises at least one of: service type, service domain, and workflow attributes.
10. The rollback processing method according to claim 1, wherein the rollback processing method is implemented based on a preset database management platform, the database management platform is deployed in a cloud computing environment and is used for managing and maintaining a database implemented in the cloud computing environment, the workflow is submitted to the database management platform in a distributed task flow manner, and by submitting an execution request and/or a rollback request of the workflow to the database management platform, the database management platform performs service processing and/or rollback processing on the submitted workflow.
11. A rollback processing apparatus, comprising:
a work task initializing unit, configured to initialize a work task of a workflow according to a previously acquired execution request for the workflow;
the rollback condition judging unit is used for judging whether the work task meets a preset rollback condition, if so, initializing a rollback task corresponding to the work task, and writing the initialized work task and the rollback task corresponding to the initialized work task into the rollback mapping relation;
a rollback request acquisition unit, configured to acquire a rollback request initiated for a workflow;
the rollback task determining unit is used for determining at least one rollback task corresponding to the work task in the execution state of the workflow and at least one rollback execution sequence of the rollback task according to a rollback mapping relation between the pre-configured work task and the rollback task;
the work task termination unit is used for terminating the execution of the work task in the execution state;
the rollback task execution unit is used for executing rollback tasks corresponding to the work tasks in the execution state according to the rollback execution sequence;
wherein the rollback task comprises: at least one rollback link consisting of rollback operations;
The initializing the rollback task corresponding to the work task comprises the following steps: and configuring the rollback operation contained in the rollback link corresponding to the work task and the rollback execution sequence of the rollback operation contained in the rollback link.
12. The rollback processing apparatus according to claim 11, wherein the rollback processing apparatus operates based on a preset database management platform deployed in a cloud computing environment for managing and maintaining databases implemented in the cloud computing environment, the workflows being submitted to the database management platform in a distributed task flow manner, and the submitted workflows being business-processed and/or rollback-processed by the database management platform by submitting execution requests and/or rollback requests of the workflows to the database management platform.
13. An electronic device, comprising:
a memory, and a processor;
the memory is for storing computer-executable instructions, and the processor is for executing the computer-executable instructions:
initializing a work task of the workflow according to a pre-acquired execution request for the workflow;
Judging whether the work task meets a preset rollback condition, if so, initializing a rollback task corresponding to the work task, and writing the initialized work task and the rollback task corresponding to the work task into the rollback mapping relation;
acquiring a rollback request initiated for a workflow;
determining at least one rollback task corresponding to the work task in the execution state of the workflow and at least one rollback execution sequence of the rollback task according to a rollback mapping relation of a pre-configured work task and the rollback task;
terminating execution of the work task in the execution state;
executing the rollback tasks corresponding to the work tasks in the execution state according to the rollback execution sequence;
wherein the rollback task comprises: at least one rollback link consisting of rollback operations;
the initializing the rollback task corresponding to the work task comprises the following steps: and configuring the rollback operation contained in the rollback link corresponding to the work task and the rollback execution sequence of the rollback operation contained in the rollback link.
CN201711181632.2A 2017-11-23 2017-11-23 Rollback processing method and device and electronic equipment Active CN109829678B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711181632.2A CN109829678B (en) 2017-11-23 2017-11-23 Rollback processing method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711181632.2A CN109829678B (en) 2017-11-23 2017-11-23 Rollback processing method and device and electronic equipment

Publications (2)

Publication Number Publication Date
CN109829678A CN109829678A (en) 2019-05-31
CN109829678B true CN109829678B (en) 2023-07-21

Family

ID=66859316

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711181632.2A Active CN109829678B (en) 2017-11-23 2017-11-23 Rollback processing method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN109829678B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110599341A (en) * 2019-09-20 2019-12-20 中国银行股份有限公司 Transaction calling method and system
CN111178823B (en) * 2019-11-28 2023-06-16 泰康保险集团股份有限公司 Method and device for canceling residence related transaction
CN114302438B (en) * 2021-12-29 2024-08-06 中国电信股份有限公司 Method, device, equipment and storage medium for processing abnormality of network element

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101807272A (en) * 2010-03-24 2010-08-18 上海普元信息技术有限责任公司 System structure and method for realizing integrities of process affairs and business affairs in workflow system
CN105989164A (en) * 2015-03-04 2016-10-05 阿里巴巴集团控股有限公司 Rollback processing method and apparatus
CN106845741A (en) * 2015-12-03 2017-06-13 北大方正集团有限公司 The customization device and customization method of workflow

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102111783A (en) * 2009-12-28 2011-06-29 中兴通讯股份有限公司 Primary subcommand rollback method and terminal
CN101977127B (en) * 2010-11-26 2013-04-10 迈普通信技术股份有限公司 SNMP (Simple Network Management Protocol) based equipment configuration roll back method and SNMP network management equipment
CN102255761B (en) * 2011-08-19 2014-05-07 迈普通信技术股份有限公司 File-based configuration rollback system and configuration rollback method
CN103699681B (en) * 2013-12-31 2017-01-04 华为技术有限公司 The treating method and apparatus of data rewind
CN105703941B (en) * 2015-12-31 2019-11-05 山石网科通信技术股份有限公司 The processing method and processing device of configuration transaction

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101807272A (en) * 2010-03-24 2010-08-18 上海普元信息技术有限责任公司 System structure and method for realizing integrities of process affairs and business affairs in workflow system
CN105989164A (en) * 2015-03-04 2016-10-05 阿里巴巴集团控股有限公司 Rollback processing method and apparatus
CN106845741A (en) * 2015-12-03 2017-06-13 北大方正集团有限公司 The customization device and customization method of workflow

Also Published As

Publication number Publication date
CN109829678A (en) 2019-05-31

Similar Documents

Publication Publication Date Title
US11138169B2 (en) Method and system for migrating content between enterprise content management systems
US10255108B2 (en) Parallel execution of blockchain transactions
US10748220B2 (en) Account processing method and apparatus
EP3353672B1 (en) Method and apparatus for transferring data between databases
US8595732B2 (en) Reducing the response time of flexible highly data parallel task by assigning task sets using dynamic combined longest processing time scheme
CN109829678B (en) Rollback processing method and device and electronic equipment
US10496659B2 (en) Database grouping set query
JP6975153B2 (en) Data storage service processing method and equipment
WO2018006723A1 (en) Database data modification request processing method and apparatus
US9971794B2 (en) Converting data objects from multi- to single-source database environment
CN109033365B (en) Data processing method and related equipment
US20110314266A1 (en) On-demand database server startup and shutdown
CN109614386B (en) Data processing method, device, server and computer readable storage medium
US10929432B2 (en) System and method for intelligent data-load balancing for backups
US10803030B2 (en) Asynchronous SQL execution tool for zero downtime and migration to HANA
US10901972B2 (en) Table partition configuration method, apparatus and system for database system
US20180253462A1 (en) Executing transactions based on success or failure of the transactions
CN110019357B (en) Database query script generation method and device
US11921586B2 (en) Method and system for backing up virtual machines in a cluster shared volume
US10303553B2 (en) Providing data backup
CN109214884B (en) Demand matching method and device and electronic equipment
US20200117763A1 (en) Relational interval tree with distinct borders
US20200042302A1 (en) Reducing downtime when applying a patch to multiple databases
CN111209286A (en) Data calling method and system
CN107491347A (en) A kind of method and apparatus for live migration of virtual machine

Legal Events

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