A task breakpoint rerun method and system based on intermediate data
By recording the execution status of task operators and intermediate data, constructing DAG graphs and storage indexes, we can realize task breakpoint re-running in the batch-stream integrated data processing system, solve the problem of data loss and duplication, and improve processing efficiency and consistency.
Patent Information
- Application Number
- CN202410139718.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-31
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2044-01-31
AI Technical Summary
In a batch-stream integrated data processing system, when anomalies in task operators cause the entire process to be rerun, problems such as data loss, data duplication, and low processing efficiency are likely to occur. Existing technologies cannot effectively solve these problems.
By recording the execution status and intermediate data of task operators, a DAG diagram is constructed to represent the execution order and direction of task operators, and the offset position and execution result flag of the input data are recorded to realize task breakpoint re-running and avoid repeated successful processing. Intermediate data for task operators.
It achieves unified transaction management at the task level and process level, ensures strong consistency of data, improves data processing efficiency, avoids data loss and duplication, and provides an efficient and stable processing architecture.
Smart Images

Figure CN117950764B
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of batch-stream integrated data processing, and in particular relates to a task breakpoint rerunning method and system based on intermediate data. Background Art
[0002] With the continuous development of big data technology, data structures are becoming more and more diversified (including structured, unstructured, and semi-structured), and data storage scenarios are becoming more and more complex (offline storage, real-time production and consumption, etc.). Many systems need to process massive amounts of offline data as well as real-time and fast computing streaming data. In order to adapt to the data requirements of various types and scenarios, a heterogeneous and multi-faceted big data batch and stream processing engine has emerged. It integrates batch processing and stream processing, and can process both bounded massive batch data with low real-time requirements and concurrent streaming data with high timeliness requirements.
[0003] In a batch-stream integrated data processing system, a data processing job is often composed of many task operators connected in series in different branches, such as Figure 2 This is an example of a data processing job: a task is processed by the data input task operator, the data distribution task operator, the data filtering task operator, the data conversion task operator, the data calculation task operator, the data cleaning task operator, the data merging task operator, and finally the data output task operator. To ensure processing efficiency, task operators and task operators execute data in a streaming manner. When a data input task operator reads a batch of data, it will immediately send it to the downstream, and so on, forming a data-driven task operator flow.
[0004] During the operation of such tasks based on task operators, various exceptions often occur, leading to active and passive termination of task operators, such as failure to connect to the data output source, failure to convert data types, node downtime, manual termination of tasks, etc. In order to ensure the accuracy and consistency of data, the entire process is generally chosen to be rerun, but in the face of massive, high-concurrency streaming data, rerunning the entire process will result in many problems such as data loss, data duplication, and low processing efficiency. In the prior art, some solutions in the industry rerun by remembering the offset of the data input source, but such solutions cannot be implemented for data sources without data offsets on the one hand; on the other hand, since the data input for the downstream task operator comes from the output result after the upstream calculation, when the data input speed is greater than the downstream processing and output speed, it is possible that the input data has not yet formed a complete transaction in the entire process, that is, it has not been executed by all operators of the task until the output, so it will still cause data loss, duplication and ultimately lead to problems such as inefficiency. Summary of the invention
[0005] In view of the above analysis, the present invention aims to provide a task breakpoint rerun method and system based on intermediate data. By recording the execution status of each task operator in the batch-stream integrated data processing task and the corresponding intermediate data, it is possible to rerun the task breakpoint based on the intermediate data when the task fails, thereby improving the processing efficiency of the data processing task and avoiding problems such as data loss and data duplication.
[0006] On the one hand, the present invention provides a task breakpoint rerun method based on intermediate data, which specifically includes the following steps:
[0007] Determine a corresponding DAG graph based on the data processing task, where the DAG graph is used to represent the execution order and execution direction of each task operator that executes the task;
[0008] Execute data processing tasks based on the DAG graph, record the offset position of the input data in the corresponding data source, the execution result flag of each task operator, record the intermediate data formed by the successfully executed task operator and mark the execution result flag of the corresponding operator as success, and mark the execution result flag of the failed task operator as failure; wherein the input data is batch data or stream data continuously read from the corresponding data source;
[0009] When the task execution fails, the task breakpoint rerun is performed based on the execution result flag and the offset position or the intermediate data.
[0010] Further, determining the corresponding DAG graph based on the data processing task includes:
[0011] Determine each node of the DAG graph based on each task operator of the task, wherein each task operator corresponds to each node one by one;
[0012] Determine the connection relationship between each node of the DAG graph based on the upstream and downstream relationship between the task operators;
[0013] A DAG graph is determined based on the nodes and corresponding connection relationships.
[0014] Furthermore, the intermediate data formed by recording the successful execution of the task operator includes:
[0015] The corresponding output data of the successfully executed task operator is used as the intermediate data;
[0016] Use an intermediate data storage engine to store the intermediate data, and clear the corresponding intermediate data of the stored upstream task operator;
[0017] A storage index is established based on the storage location information of the intermediate data; the storage index is used to read and obtain the corresponding intermediate data to be executed.
[0018] Furthermore, the storage index is a sparse index that increases in sequence.
[0019] Furthermore, when executing a data processing task, except for the first task operator, other task operators read corresponding intermediate data as input from the intermediate data storage engine based on the storage index provided by its adjacent upstream task operator.
[0020] Further, the executing task breakpoint rerun based on the execution result flag and the offset position or intermediate data includes:
[0021] Traverse the execution result flags of each task operator and determine the task operator with a failed execution result flag as a failed operator:
[0022] If the failed operator is the first task operator, the input data is read from the corresponding data source based on the offset position to execute the task breakpoint rerun;
[0023] Otherwise, the failed operator reads the corresponding intermediate data based on the storage index input to the task operator when the failure occurs and executes the task breakpoint rerun.
[0024] Further, the input data is real-time streaming data, offline unstructured files or offline structured data; the offset position of the recorded input data in the corresponding data source includes:
[0025] For real-time streaming data, the offset position of the input data in the data source is determined based on the offset of consumption;
[0026] For offline unstructured files, the offset position of the input data in the data source is determined based on the file ID, the account information to which the file belongs, and the full path of the file;
[0027] For offline structured data, the offset position of the input data in the data source is determined based on the data row number, business time or primary key of the input data.
[0028] Furthermore, for offline unstructured files, the MD5 algorithm is used to determine the offset position of the input data in the data source based on the file ID, the account information to which the file belongs, and the full path of the file.
[0029] On the other hand, the present invention provides a task breakpoint rerunning system based on intermediate data, comprising:
[0030] A task configuration module is used to determine a corresponding DAG graph based on a data processing task, where the DAG graph is used to represent the execution order and execution direction of each task operator that executes the task;
[0031] The task execution module is used to execute data processing tasks based on the DAG graph and record the execution result flags formed by each task operator during execution; the input data is batch data or stream data continuously read from the data source;
[0032] An intermediate data storage module is used to store the intermediate data generated by successfully executed task operators;
[0033] The task breakpoint rerun module is used to determine the task breakpoint to execute the task breakpoint rerun based on the execution result flag and the offset position or intermediate data when the task execution fails.
[0034] Furthermore, the intermediate data storage module stores the output data of the successfully executed task operator as the intermediate data of the task operator; and simultaneously clears the corresponding intermediate data of the upstream task operator of the task operator.
[0035] The present invention can achieve at least one of the following beneficial effects:
[0036] By using the intermediate data storage engine, we can adapt to the breakpoint problems of various heterogeneous data sources, as well as the breakpoint problems of temporary data output of various computing and conversion tasks. By combining the batch stream processing engine with intermediate data, we can achieve unified transaction management at the task level and process level, ensure strong data consistency, and provide an efficient, stable, and idempotent technical architecture for big data job processing.
[0037] By establishing a sparse storage index for intermediate data and recording the offset position of the input data of the data processing task in the corresponding data source, it is possible to accurately read the input data and intermediate data when rerunning at breakpoints, avoiding data duplication and data loss.
[0038] Other features and advantages of the present invention will be described in the following description, and some advantages may become apparent from the description, or may be understood by practicing the present invention. The purpose and other advantages of the present invention may be realized and obtained through the contents particularly pointed out in the description, claims and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] The accompanying drawings are only used for the purpose of illustrating specific embodiments and are not to be considered as limiting the present invention. In the entire drawings, the same reference symbols represent the same components;
[0040] Figure 1 This is a flow chart of the task breakpoint rerun method of the present invention;
[0041] Figure 2 This is an example of a DAG graph for a data processing task of the present invention;
[0042] Figure 3 This is a schematic diagram of storage indexes of the present invention. DETAILED DESCRIPTION
[0043] The preferred embodiments of the present invention will be described in detail below in conjunction with the accompanying drawings, wherein the accompanying drawings constitute a part of this application and are used together with the embodiments of the present invention to illustrate the principles of the present invention, but are not used to limit the scope of the present invention.
[0044] Method Embodiment
[0045] A specific embodiment of the present invention discloses a task breakpoint rerun method based on intermediate data, which specifically includes the following steps:
[0046] Step S01: Determine a corresponding DAG graph based on a batch-stream integrated data processing task, where the DAG graph is used to represent the execution order and execution direction of each task operator that executes the task;
[0047] Step S02: Execute the data processing task based on the DAG graph, record the offset position of the input data in the corresponding data source and the execution result flag of each task operator during execution, and when the execution result flag is successful, record the intermediate data formed by the task operator; mark the execution result flag of the task operator that failed to execute as failed; wherein the input data is batch data or stream data continuously read from the corresponding data source;
[0048] Step S03: When the task fails to execute, re-run the task breakpoint based on the execution result flag and the offset position or the intermediate data. Specifically, when the task fails to execute, if the task operator corresponding to the execution result flag as failed is the first task operator, re-run the task breakpoint based on the offset position; if the task operator corresponding to the execution result flag as failed is not the first task operator, re-run the task breakpoint based on the intermediate data.
[0049] The present embodiment discloses a task breakpoint rerun method based on intermediate data. By recording the offset position of the input data, recording the execution result flag of each task operator, and storing the intermediate data of each successfully executed task operator, when the task execution fails, the batch-stream integrated data processing task can be breakpoint rerun based on the execution result flag, offset position and intermediate data, thereby improving the efficiency of batch-stream integrated data processing and avoiding problems such as data loss and data duplication that may occur during breakpoint rerun.
[0050] Specifically, in step S01, determining the corresponding DAG graph based on the data processing task includes:
[0051] Step S011, determining each node of the DAG graph based on each task operator of the task, wherein each task operator corresponds to each node one by one; wherein the task operator is the execution subject of each subtask in the data processing task; and the task operators included in different tasks may be different.
[0052] Step S012: determining the connection relationship of each node of the DAG graph based on the upstream and downstream relationship between each task operator; the upstream and downstream relationship between each task operator represents the execution sequence relationship of each subtask in the data processing task.
[0053] Step S013: Determine a DAG graph based on the nodes and corresponding connection relationships.
[0054] Specifically, in step S02, after the batch-stream integrated data processing task is started, each task operator is started in sequence according to the execution direction and execution order shown in the DAG diagram to execute the data processing task.
[0055] Furthermore, the first task operator in a data processing task is usually a data input task operator, which continuously reads batch data or stream data from various heterogeneous data sources, including real-time stream data, offline unstructured files, or offline structured data.
[0056] The offset position is used to indicate the relative position of the input data in the corresponding data source. When a task needs to be rerun due to a breakpoint failure, data can be read from the corresponding data source based on the offset position to support breakpoint rerun.
[0057] Furthermore, for real-time streaming data, such as incremental data of a relational database, a message queue, etc., the offset position of the input data in the data source is determined based on the offset of consumption;
[0058] For offline unstructured files, such as pictures and documents stored in a distributed file system or a local file system, the offset position of the input data in the data source, i.e., the corresponding file system, is determined based on the file ID, the account information to which the file belongs, and the full path of the file; specifically, the MD5 algorithm is used to calculate the summary information of the string formed by the file ID, the account information to which the file belongs, and the full path of the file to obtain the offset position information of the file in the corresponding file system;
[0059] For offline structured data, such as relational databases, big data storage engines, and document databases, the offset position of the input data in the data source is determined based on the data row number, business time, or primary key of the input data.
[0060] Specifically, in step SO2, data is not directly transferred between task operators in the data processing task, but is transferred based on the intermediate data storage engine. That is, after the first task operator successfully executes the input data, the output of the operator is stored as the first intermediate data in the intermediate data storage engine, and the execution result of the operator for the input data is marked as successful; the adjacent downstream task operator of the first task operator reads the first intermediate data from the intermediate data storage engine as the input of the downstream task operator to execute the task, and stores the output after successful execution as the second intermediate data in the intermediate data storage engine to mark the corresponding execution result as successful, and clears the first intermediate data to save resources and avoid misreading; and so on, until the last operator of the data processing task is successfully executed and the final execution result data is output. Each task operator processes its own input, output and intermediate data storage, which is regarded as a transaction. Only when the execution of a piece of data is successful and the storage of the corresponding intermediate result is completed, the corresponding execution result is marked as successful, otherwise it is marked as failed. The transaction indicates that the corresponding operation is an atomic operation and is indivisible.
[0061] Furthermore, the intermediate data generated by the successfully executed task operator includes:
[0062] The corresponding output data of the successfully executed task operator is used as the intermediate data;
[0063] Use an intermediate data storage engine to store the intermediate data, and clear the corresponding intermediate data of the stored upstream task operator; it should be noted that clearing the corresponding intermediate data of the upstream operator can avoid the accumulation of too much intermediate data and cause the storage to be full;
[0064] A storage index is established based on the storage location information of the intermediate data; the storage index is a sequentially increasing sparse index, which is used to read the corresponding intermediate data to be executed, that is, except for the first task operator, other task operators read the corresponding intermediate data as input from the intermediate data storage engine based on the storage index provided by its adjacent upstream task operator. Optionally, a binary search algorithm can be used during reading to quickly locate the location of the storage index.
[0065] Furthermore, the intermediate data storage engine is persistent. Optionally, a local disk or distributed file system is used, and block storage is used to provide efficient, low-latency, and scalable storage performance. When writing intermediate data, the writing is done in a rolling order. When the set block size is reached, a new block file is generated to continue writing. It should be noted that the writing performance of sequential writing is higher than that of random memory writing on most devices.
[0066] For example, Figure 3The figure shows a storage index schematic diagram of the intermediate data storage engine. The *.data area on the right side of the figure is the storage area of the intermediate data storage engine, including the storage location information position of the intermediate data and the intermediate data data. The *.index on the left side of the figure is the storage index area, including the index offset and position.
[0067] Specifically, in step S03, when one or more task operators in the task fail to execute due to an exception or error, it indicates that the task execution has failed. At this time, the execution result flag of the failed task operator is failure, and the task breakpoint rerun is performed based on the execution result flag and the offset position or intermediate data. Including:
[0068] Traverse the execution result flags of each task operator, and determine the task operator with a failed execution result flag as a failed operator;
[0069] If the failed operator is the first task operator, the input data is read from the corresponding data source based on the offset position to execute the task breakpoint rerun;
[0070] Otherwise, the failed operator reads the corresponding intermediate data based on the storage index input to the task operator when the failure occurs and executes the task breakpoint rerun.
[0071] It should be noted that the task operator that successfully executed the input data does not need to be reprocessed, and the data processing task of the corresponding input data will only be continued from the corresponding task operator that failed to execute. As mentioned earlier, since each task operator processes its own input as a transaction, the corresponding execution result will be marked as successful only after the execution is successful and the corresponding intermediate results are stored. This means that if the task operator has successfully read the corresponding intermediate data but the calculation or output is not completed, its execution result will be marked as failed, and the task operator also needs to be rerun. This can avoid data loss and data duplication, and accurately rerun the visual task breakpoint.
[0072] Furthermore, if the failed operator is the first task operator, namely the data input task operator, the input data is re-read from the corresponding data source based on the offset position to execute the task breakpoint rerun.
[0073] Furthermore, for other failed operators, the corresponding intermediate data is read based on the storage index input to the task operator at the time of failure. That is, since the execution result of the adjacent upstream operator of the failed operator is successful, the intermediate data processing engine stores the intermediate data of the adjacent upstream operator as the input of the task operator. Then, based on the storage index input when executing the task of the failed operator, the corresponding intermediate data can be read to perform breakpoint rerun.
[0074] The present embodiment discloses a task breakpoint rerun method based on intermediate data, which adapts to the breakpoint problems of various heterogeneous data sources by recording the execution status of each task operator in the batch-stream integrated data processing task and the corresponding intermediate data, and realizes the task breakpoint rerun based on the intermediate data when the task fails, thereby improving the processing efficiency of the data processing task. By establishing a sparse storage index for the intermediate data and recording the offset position of the input data of the data processing task in the corresponding data source, it is possible to accurately read the input data and intermediate data when rerunning the breakpoint, avoiding data duplication and data loss.
[0075] System Example
[0076] Another specific embodiment of the present invention discloses a task breakpoint rerun system based on intermediate data, which realizes the functions of the batch-stream integrated data processing system in the prior art and realizes the task breakpoint rerun function based on intermediate data. The system includes a task configuration module, a task execution module, an intermediate data storage module and a task breakpoint rerun module.
[0077] Specifically, the task configuration module is used to determine the corresponding DAG graph based on the data processing task, and the DAG graph is used to represent the execution order and execution direction of each task operator that executes the task.
[0078] Furthermore, in the task configuration module, you can choose whether the data processing task to be executed currently needs to enable breakpoint rerunning. For data processing tasks that do not require high data integrity or have a small amount of data and can be run repeatedly, it does not need to be enabled.
[0079] Specifically, the task execution module is used to execute data processing tasks based on the DAG graph, and record the execution result flag formed by each task operator during execution.
[0080] Furthermore, when the task execution module executes a task, the batch-stream integrated processing engine of the batch-stream integrated data processing system in the prior art will submit the task to the distributed execution node, and select the first task operator, namely the data input task operator, to start executing the task.
[0081] Furthermore, the batch-stream integrated processing engine will adapt to the data reading interfaces of various heterogeneous input sources and parse the data into a universal record format for the engine.
[0082] Furthermore, when the data input task operator reads the input data, the offset position of the input data in the corresponding data source.
[0083] Specifically, the intermediate data storage module is used to store the intermediate data generated by the successfully executed task operators.
[0084] Furthermore, the intermediate data storage module stores the output data of the successfully executed task operator as the intermediate data of the task operator and establishes a storage index; and at the same time clears the corresponding intermediate data of the upstream task operator of the task operator.
[0085] Furthermore, the intermediate data storage module cleans up the intermediate data related to a task after the task is successfully executed, and regularly cleans up expired intermediate data to avoid the problem of storage being full.
[0086] Specifically, the task breakpoint rerun module is used to determine the task breakpoint to execute the task breakpoint rerun based on the execution result flag and the offset position or intermediate data when the task execution fails.
[0087] Furthermore, when the system is implemented, the task breakpoint rerun module can be set to automatically rerun or manually rerun.
[0088] Compared with the prior art, the beneficial effects of a task breakpoint rerunning system based on intermediate data provided by this embodiment are basically the same as the beneficial effects provided by the method embodiment, which will not be elaborated here.
[0089] It should be noted that the above embodiments are based on the same inventive concept and parts not described repeatedly can be used as reference for each other.
[0090] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by any technician familiar with the technical field within the technical scope disclosed by the present invention should be covered within the protection scope of the present invention.
Claims
1. A task breakpoint rerun method based on intermediate data, characterized in that: The steps include: Determining a corresponding DAG graph based on a data processing task includes: determining each node of the DAG graph based on each task operator of the task, wherein each task operator corresponds to each node one by one; determining a connection relationship between each node of the DAG graph based on an upstream and downstream relationship between each task operator; determining a DAG graph based on each node and a corresponding connection relationship; the DAG graph is used to represent an execution order and an execution direction of each task operator that executes the task; Execute data processing tasks based on the DAG graph, record the offset position of the input data in the corresponding data source, the execution result flag of each task operator during execution, record the intermediate data formed by the successfully executed task operator and mark the execution result flag of the corresponding operator as success, and mark the execution result flag of the failed task operator as failure; wherein the input data is batch data or stream data continuously read from the corresponding data source; the recording of the intermediate data formed by the successfully executed task operator includes: taking the corresponding output data of the successfully executed task operator as the intermediate data; using the intermediate data storage engine to store the intermediate data, and clearing the corresponding intermediate data of the stored upstream task operator; establishing a storage index based on the storage location information of the intermediate data; the storage index is used to read and obtain the corresponding intermediate data to be executed; When the task execution fails, the task breakpoint rerun is performed based on the execution result flag and the offset position or the intermediate data, including: traversing the execution result flags of each task operator, and determining the task operator with a failed execution result flag as a failed operator: if the failed operator is the first task operator, the input data is read from the corresponding data source based on the offset position to perform the task breakpoint rerun; otherwise, the failed operator reads the corresponding intermediate data based on the storage index input to the task operator at the time of failure to perform the task breakpoint rerun.
2. The task breakpoint rerun method according to claim 1, characterized in that: The storage index is a sparse index that increases in sequence.
3. The task breakpoint rerun method according to claim 2, characterized in that: When executing a data processing task, except for the first task operator, other task operators read corresponding intermediate data as input from the intermediate data storage engine based on the storage index provided by its adjacent upstream task operator.
4. The task breakpoint rerun method according to claim 3, characterized in that: The input data is real-time streaming data, offline unstructured files or offline structured data; the offset position of the recorded input data in the corresponding data source includes: For real-time streaming data, the offset position of the input data in the data source is determined based on the offset of consumption; For offline unstructured files, the offset position of the input data in the data source is determined based on the file ID, the account information to which the file belongs, and the full path of the file; For offline structured data, the offset position of the input data in the data source is determined based on the data row number, business time or primary key of the input data.
5. The task breakpoint rerun method according to claim 4, characterized in that: For offline unstructured files, the MD5 algorithm is used to determine the offset position of the input data in the data source based on the file ID, the account information to which the file belongs, and the full path of the file.
6. A task breakpoint rerunning system based on intermediate data, characterized in that: include: The task configuration module is used to determine the corresponding DAG graph based on the data processing task, including: determining each node of the DAG graph based on each task operator of the task, wherein each task operator corresponds to each node one by one; determining the connection relationship of each node of the DAG graph based on the upstream and downstream relationship between each task operator; determining the DAG graph based on each node and the corresponding connection relationship; the DAG graph is used to represent the execution order and execution direction of each task operator that executes the task; A task execution module is used to execute data processing tasks based on a DAG graph. During execution, the offset position of the input data in the corresponding data source and the execution result flag formed by each task operator are recorded, the intermediate data formed by the successfully executed task operator are marked with the execution result flag of the corresponding operator as success, and the execution result flag of the failed task operator is marked with failure; wherein, the input data is batch data or stream data continuously read from the data source; the recording of the intermediate data formed by the successfully executed task operator includes: using the corresponding output data of the successfully executed task operator as the intermediate data; using the intermediate data storage module to store the intermediate data, and clearing the corresponding intermediate data of the stored upstream task operator; establishing a storage index based on the storage location information of the intermediate data; the storage index is used to read and obtain the corresponding intermediate data to be executed; An intermediate data storage module, used to store the intermediate data and the storage index formed by the successfully executed task operator; The task breakpoint rerun module is used to determine the task breakpoint to execute the task breakpoint rerun based on the execution result flag and the offset position or intermediate data when the task execution fails.
7. The task breakpoint rerunning system according to claim 6, characterized in that: The intermediate data storage module stores the output data of the successfully executed task operator as the intermediate data of the task operator; and simultaneously clears the corresponding intermediate data of the upstream task operator of the task operator.
