Task processing method and device, computer device, readable storage medium and product
By executing tasks in parallel with the main processing node and the sub-processing nodes, the target field information is extracted and synchronized. By adopting asynchronous and real-time synchronization modes, the problems of low information synchronization efficiency and data discrepancies in multi-active systems are solved, and efficient and low-cost information synchronization and disaster recovery switching are achieved.
Patent Information
- Application Number
- CN202611499769.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-24
- Publication Date
- 2026-11-24
AI Technical Summary
In a multi-active system, the high read/write pressure on the primary environment leads to slower task processing speed and reduced information synchronization efficiency. Furthermore, the data synchronization process consumes a large amount of dedicated line bandwidth, increasing hardware costs. The synchronization latency in remote data centers is high, disaster recovery switching takes a long time, and data discrepancies and switching failures are likely to occur.
The main processing node acquires the target task and sends it to the sub-processing nodes. It extracts the field information of the target field and synchronizes it to the sub-processing nodes for correction. It adopts asynchronous and real-time synchronization modes to reduce the amount of data, reduce dedicated line bandwidth overhead, and improve information synchronization efficiency.
By reducing the amount of data synchronized between nodes, read and write pressure is reduced, information synchronization efficiency is improved, consistency of multi-node processing results is ensured, data discrepancies are reduced, and disaster recovery switchover time is shortened.
Smart Images

Figure CN123157472A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a task processing method, apparatus, computer device, computer-readable storage medium, and computer program product. Background Technology
[0002] With the development of information technology, task processing systems have been widely used in fields such as finance, telecommunications, and the internet. Task processing systems typically require multiple processing nodes to work collaboratively to complete large-scale data processing tasks.
[0003] To improve system availability and disaster recovery capabilities, multi-active (multi-node) deployment architectures have emerged, which involve deploying processing nodes across multiple geographically dispersed data centers. Currently, multi-active systems typically employ a master-slave synchronization approach: the master environment's batch servers accept scheduling and execute jobs, while database data and business files are fully replicated to the disaster recovery environment. However, business operations generate large amounts of data, especially batch jobs, which puts significant read and write pressure on the master environment, reducing its task processing speed and thus impacting the efficiency of information synchronization between nodes. Summary of the Invention
[0004] Therefore, it is necessary to provide a task processing method, apparatus, computer equipment, computer-readable storage medium, and computer program product that can improve the efficiency of information synchronization between processing nodes in order to address the above-mentioned technical problems.
[0005] In a first aspect, this application provides a task processing method applied to a main processing node, wherein the main processing node is communicatively connected to at least one sub-processing node; the method includes:
[0006] The target task to be processed is obtained and sent to the sub-processing node; the sub-processing node is used to execute the target task and obtain the first processing result.
[0007] If a second processing result is obtained by executing the target task, the field information of the target field is extracted from the second processing result; the target field refers to the random field that will produce deviations when different processing nodes execute the same task.
[0008] The field information is synchronized to the sub-processing nodes so that the sub-processing nodes can correct the content of the target field in the first processing result based on the field information, and obtain the corrected processing result; the corrected processing result is consistent with the content of the second processing result.
[0009] In one embodiment, the method further includes:
[0010] The activity status detection task is executed to obtain activity status information, and the activity status information is synchronized to the sub-processing nodes. The activity status information is used to indicate whether the main processing node is currently in an active state.
[0011] When the activity status information indicates that the main processing node is currently inactive, it stops receiving external input data and stops outputting data, and the sub-processing node is changed to the new main processing node.
[0012] In one embodiment, the method further includes:
[0013] Upon recovery from an inactive state to an active state, receive synchronization information sent by the new master processing node;
[0014] The current processing result is updated based on the synchronization information to ensure that the current processing result of the main processing node is consistent with the processing result of the new main processing node in terms of content.
[0015] Once the processing results are updated and the current task execution environment meets the node restoration conditions, the node is restored to the main processing node.
[0016] In one embodiment, field information is synchronized to the sub-processing nodes so that the sub-processing nodes can correct the field content of the target field in the first processing result based on the field information, including:
[0017] Obtain the synchronization mode identifier corresponding to the field information, and if the synchronization mode identifier indicates that asynchronous synchronization is allowed, store the field information in the asynchronous transmission queue;
[0018] According to the preset time period, the field information in the asynchronous transmission queue is sent to the sub-processing node, so that the sub-processing node can asynchronously correct the field content of the target field in the first processing result based on the field information.
[0019] In one embodiment, the method further includes:
[0020] When the synchronization mode identifier indicates real-time synchronization, the field information is stored in the synchronization transmission queue;
[0021] The field information in the synchronous transmission queue is sent to the sub-processing node in real time, so that the sub-processing node can correct the field content of the target field in the first processing result in real time based on the field information.
[0022] In one embodiment, the method further includes:
[0023] If the target task contains at least one subtask for generating external output data, execute the subtask and generate a task skip instruction for the subtask.
[0024] Send a task skip instruction to the sub-processing node so that the sub-processing node will not execute the sub-task as instructed by the task skip instruction.
[0025] Secondly, this application also provides a task processing apparatus, applied to a main processing node, the main processing node being communicatively connected to at least one sub-processing node; the apparatus includes:
[0026] The task distribution module is used to obtain the target tasks to be processed and send the target tasks to the sub-processing nodes; the sub-processing nodes are used to execute the target tasks and obtain the first processing result.
[0027] The information extraction module is used to extract field information of the target field from the second processing result obtained by executing the target task; the target field refers to the random field that will produce deviations when different processing nodes execute the same task.
[0028] The information synchronization module is used to synchronize field information to the sub-processing nodes, so that the sub-processing nodes can correct the field content of the target field in the first processing result based on the field information to obtain the corrected processing result; the corrected processing result is consistent with the content of the second processing result.
[0029] In one embodiment, the device further includes:
[0030] The status detection module is used to perform activity status detection tasks, obtain activity status information, and synchronize the activity status information to the sub-processing nodes. The activity status information is used to indicate whether the main processing node is currently in an active state.
[0031] The service stop module is used to stop receiving external input data and stop outputting data when the activity status information indicates that the main processing node is currently inactive, and the sub-processing node is changed to the new main processing node.
[0032] In one embodiment, the device further includes:
[0033] The recovery receiving module is used to receive synchronization information sent by the new master processing node when recovering from an inactive state to an active state.
[0034] The result update module is used to update the current processing result based on the synchronization information, so that the current processing result of the main processing node is consistent with the processing result of the new main processing node in terms of content.
[0035] The node restoration module is used to restore the main processing node when the processing result has been updated and the current task execution environment meets the node restoration conditions.
[0036] In one embodiment, the information synchronization module further includes:
[0037] An asynchronous storage unit is used to obtain the synchronization mode identifier corresponding to the field information, and store the field information into the asynchronous transmission queue when the synchronization mode identifier indicates that asynchronous synchronization is allowed;
[0038] The asynchronous sending unit is used to send the field information in the asynchronous transmission queue to the sub-processing node according to a preset time period, so that the sub-processing node can asynchronously correct the field content of the target field in the first processing result based on the field information.
[0039] In one embodiment, the device further includes:
[0040] The real-time storage module is used to store field information into the synchronization transmission queue when the synchronization mode identifier indicates real-time synchronization.
[0041] The real-time sending module is used to send the field information in the synchronous transmission queue to the sub-processing nodes in real time, so that the sub-processing nodes can correct the field content of the target field in the first processing result in real time based on the field information.
[0042] In one embodiment, the device further includes:
[0043] The instruction generation module is used to execute the subtask and generate task skip instructions for the subtask when the target task contains at least one subtask for generating external output data.
[0044] The instruction sending module is used to send task skip instructions to the sub-processing nodes so that the sub-processing nodes do not execute the sub-tasks under the instruction of the task skip instructions.
[0045] Thirdly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:
[0046] The target task to be processed is obtained and sent to the sub-processing node; the sub-processing node is used to execute the target task and obtain the first processing result.
[0047] If a second processing result is obtained by executing the target task, the field information of the target field is extracted from the second processing result; the target field refers to the random field that will produce deviations when different processing nodes execute the same task.
[0048] The field information is synchronized to the sub-processing nodes so that the sub-processing nodes can correct the content of the target field in the first processing result based on the field information, and obtain the corrected processing result; the corrected processing result is consistent with the content of the second processing result.
[0049] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, performs the following steps:
[0050] The target task to be processed is obtained and sent to the sub-processing node; the sub-processing node is used to execute the target task and obtain the first processing result.
[0051] If a second processing result is obtained by executing the target task, the field information of the target field is extracted from the second processing result; the target field refers to the random field that will produce deviations when different processing nodes execute the same task.
[0052] The field information is synchronized to the sub-processing nodes so that the sub-processing nodes can correct the content of the target field in the first processing result based on the field information, and obtain the corrected processing result; the corrected processing result is consistent with the content of the second processing result.
[0053] Fifthly, this application also provides a computer program product, including a computer program that, when executed by a processor, performs the following steps:
[0054] The target task to be processed is obtained and sent to the sub-processing node; the sub-processing node is used to execute the target task and obtain the first processing result.
[0055] If a second processing result is obtained by executing the target task, the field information of the target field is extracted from the second processing result; the target field refers to the random field that will produce deviations when different processing nodes execute the same task.
[0056] The field information is synchronized to the sub-processing nodes so that the sub-processing nodes can correct the content of the target field in the first processing result based on the field information, and obtain the corrected processing result; the corrected processing result is consistent with the content of the second processing result.
[0057] The aforementioned task processing method, apparatus, computer equipment, computer-readable storage medium, and computer program product are applied to a main processing node, which is communicatively connected to at least one sub-processing node. First, the main processing node acquires the target task to be processed and sends it to the sub-processing nodes. Thus, the main processing node and the sub-processing nodes execute the same target task in parallel, each obtaining its corresponding processing result. When the main processing node obtains a second processing result by executing the target task, it extracts only the field information of the target field from the second processing result and synchronizes it to the sub-processing nodes. Since the target field is a random field that will produce deviations when different processing nodes execute the same task, while non-target fields are consistent when each node executes independently, synchronizing only the field information of the target field is sufficient to achieve consistency in the processing results of each node. Finally, the sub-processing nodes correct the field content of the target field in the first processing result based on the field information, obtaining a corrected processing result consistent with the content of the second processing result. In this way, this scheme significantly reduces the amount of data synchronized between nodes, reduces dedicated line bandwidth overhead, and alleviates the read / write pressure on the main processing node, thereby effectively improving the information synchronization efficiency between nodes. At the same time, the reduced amount of synchronized data lowers the probability of data discrepancies and improves the consistency of multi-node processing results. Attached Figure Description
[0058] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0059] Figure 1 This is an application environment diagram of a task processing method in one embodiment;
[0060] Figure 2 This is a flowchart illustrating a task processing method in one embodiment;
[0061] Figure 3 This is a schematic diagram of the node switching process in one embodiment;
[0062] Figure 4 This is a schematic diagram of the main processing node restoration process in one embodiment;
[0063] Figure 5 This is a schematic diagram illustrating the asynchronous synchronization process of field information in one embodiment;
[0064] Figure 6 This is a schematic diagram illustrating the real-time synchronization process of field information in one embodiment;
[0065] Figure 7 This is a schematic diagram of the execution flow of an outgoing task in one embodiment;
[0066] Figure 8 This is a schematic diagram of the various stages of a task processing method in one embodiment;
[0067] Figure 9 This is a structural block diagram of a task processing device in one embodiment;
[0068] Figure 10 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0069] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application. It should be noted that existing industry solutions such as software, components, and models may be mentioned in the embodiments of this application. These should be considered exemplary and are intended only to illustrate the feasibility of implementing the technical solutions of this application, but do not imply that the applicant has already used or necessarily used such solutions.
[0070] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of related data must comply with relevant regulations. The acquisition, storage, use and processing of data in the technical solution of this application all comply with the relevant provisions of national laws and regulations.
[0071] The terms "first," "second," etc., used in this application may be used to describe various elements, but these elements are not limited by these terms. These terms are used only to distinguish the first element from the second element. The terms "comprising" and "having," and any variations thereof, used in this application, are intended to cover non-exclusive inclusion. The term "multiple" used in this application refers to two or more. The term "and / or" used in this application refers to one of the embodiments, or any combination of multiple embodiments.
[0072] With the development of information technology, task processing systems have been widely used in finance, telecommunications, the internet, and other fields. Task processing systems typically require multiple processing nodes to work collaboratively to complete large-scale data processing tasks, especially batch tasks. To improve system availability and disaster recovery capabilities, multi-active (multi-node) deployment architectures have emerged, where processing nodes are deployed on multiple geographically dispersed data nodes, each capable of providing services simultaneously.
[0073] In traditional technologies, the construction of multi-active batch processing systems typically employs a primary-backup synchronous approach: the primary batch server receives scheduling and executes batch jobs, while the disaster recovery batch server remains idle; the primary environment connects to its own database and network storage for data processing, synchronizing data from the primary database to the disaster recovery database, and synchronizing files from the primary network storage to the disaster recovery network storage. When the primary environment fails, the system switches to the disaster recovery environment to continue batch processing.
[0074] However, the traditional methods described above have the following problems: First, batch processing generates massive amounts of data, and full data replication consumes a large amount of dedicated line bandwidth. As the volume of business data increases, the hardware cost of the dedicated line also increases significantly. Second, the process of synchronizing large amounts of data puts additional read and write pressure on the primary environment. In scenarios where the equipment load is already close to its limit, it will slow down the batch processing speed of the primary environment, thereby affecting synchronization efficiency. Third, when primary environment failures or network failures occur, data discrepancies are likely to occur. In batch processing with long processes, even small data deviations can cause business problems to spread. Fourth, in remote data center scenarios, the synchronization latency is large, batch disaster recovery switching takes a long time, and sometimes switching failures may even occur.
[0075] To address the aforementioned technical problems, embodiments of this application provide a task processing method that can be applied to, for example... Figure 1 In the application environment shown, the main processing node 102 communicates with at least one sub-processing node 104 via a network. The data storage system can store the data that the main processing node and sub-processing nodes need to process. The data storage system can be integrated on the corresponding nodes or placed in the cloud or on other network servers. The main processing node and sub-processing nodes can be independent physical servers, server clusters or distributed systems composed of multiple physical servers, or cloud servers providing cloud computing services. The nodes can be deployed in the same data center or in different data centers in the same city or different locations, forming a multi-active batch processing architecture.
[0076] Specifically, the main processing node 102 obtains the target task to be processed and sends the target task to the sub-processing node 104; the sub-processing node 104 executes the target task and obtains a first processing result; when the main processing node 102 obtains a second processing result from the execution of the target task, it extracts the field information of the target field from the second processing result; and synchronizes the field information to the sub-processing node 104 so that the sub-processing node 104 can correct the field content of the target field in the first processing result based on the field information, and obtain a corrected processing result, which is consistent with the content of the second processing result.
[0077] In one exemplary embodiment, such as Figure 2As shown, a task processing method is provided, which is applied to Figure 1 Taking the main processing node 102 as an example, the explanation includes the following steps S202 to S206. Wherein:
[0078] Step S202: Obtain the target task to be processed and send the target task to the sub-processing node; the sub-processing node is used to execute the target task and obtain the first processing result.
[0079] In this context, the target task refers to a task that requires processing by multiple nodes, and can be at least one of the following: data computation, file processing, report generation, etc. In this embodiment, the target task can specifically be a batch task. The primary processing node is the processing node currently responsible for external services, while the secondary processing nodes are processing nodes that communicate with the primary processing node, perform the same tasks, but do not assume external service responsibilities. There can be one or more secondary processing nodes. External service responsibilities refer to the responsibility of a processing node to interact with external systems, specifically including but not limited to receiving external input files sent by upstream systems and sending output result files generated by the node to external systems. In a multi-active architecture where the primary processing node and secondary processing nodes execute the same task in parallel, only the primary processing node assumes external service responsibilities, and all secondary processing nodes cease external services to avoid multiple nodes repeatedly receiving or sending data.
[0080] The first processing result refers to the processing output obtained by the sub-processing node after independently executing the target task. Specifically, it manifests as updated table record data in the local database of the sub-processing node, and generated or modified file data in the local storage of the sub-processing node. The difference between the first processing result and the second processing result is that they are generated independently by different nodes, and there may be deviations in the target fields due to different execution environments.
[0081] For example, after the main processing node obtains the target task, it distributes the complete target task to each sub-processing node. Upon receiving the target task, each sub-processing node independently executes the target task completely, generating the first processing result. It can be understood that the sub-processing nodes fully execute the business logic, and the non-random business fields in the processing result are calculated locally without requiring synchronization from external nodes.
[0082] For example, suppose there are five nodes A, B, C, D, and E. Initially, node A is the main processing node (main environment), and nodes B, C, D, and E are sub-processing nodes (sub-nodes), each relatively independent. After the main processing node A obtains the target task to be processed, it sends the target task to the sub-processing nodes B, C, D, and E, so that the five nodes A, B, C, D, and E execute the same task in parallel.
[0083] In some embodiments, the master processing node reads a pre-generated node configuration list, which records the identity information of each processing node in execution order, such as "A|B|C|D|E", where A is the master processing node and B, C, D, and E are sub-processing nodes. The master processing node determines the receiving address of each sub-processing node based on this list and concurrently sends the target task to each sub-processing node. If the master processing node fails to send the target task to a sub-processing node, it can attempt to resend it, or send the target task to the next sub-processing node in the order of the node configuration list to ensure that the target task can be executed normally. For example, if A successfully receives the target task file, A copies and sends this file to B, C, D, and E through an internal transmission node (Anode), thus ensuring that all five data centers receive this externally input task file.
[0084] Step S204: If a second processing result is obtained by executing the target task, extract the field information of the target field from the second processing result.
[0085] The second processing result refers to the processing output obtained by the main processing node after independently executing the target task. Specifically, it manifests as updated table record data in the main processing node's local database and generated or modified file data in the main processing node's local storage. The second processing result is the data source for subsequently extracting field information from the target fields.
[0086] A target field refers to a random field that causes deviations when different processing nodes execute the same task. Specifically, it refers to a field whose values differ in the processing result due to differences in at least one factor, such as the execution environment or execution time, after the sub-processing nodes and the main processing node execute the same target task independently. Examples include: a timestamp field recording processing time, a sequence number field that varies depending on the execution order, an auto-incrementing identifier field that varies depending on the node identifier, and a temporary state field that varies depending on the intermediate state. Fields other than target fields are non-target fields, and non-target fields have the same value when each node executes independently.
[0087] Field information refers to the data extracted from the second processing result and used to synchronize to the sub-processing nodes. It contains at least two parts: first, a record identifier used to locate the record to which the target field belongs, such as the primary key field value of a table; and second, the specific field content of the target field, such as at least one of the timestamp value or sequence number value.
[0088] For example, after the main processing node completes the target task and obtains the second processing result, it extracts the field information of the target field from the second processing result according to a pre-configured field list. This field list can be pre-defined through a configuration file, specifying which fields belong to the target fields and the synchronization mode identifier corresponding to each group of target fields. The synchronization mode identifier is divided into two types: real-time synchronization (the example configuration value is "No") and asynchronous synchronization is allowed (the example configuration value is "Yes").
[0089] For example, tasks include job0001 to jobxxxx. The configuration format of the database task list jobDB.list is: "jobname|table name|primary key field 1, primary key field 2, primary key field 3, primary key field 4...|random field 1, random field 2, random field 3, random field 4...|whether asynchronous processing is possible|".
[0090] jobDB.list includes:
[0091] job00bb|table_a|PKa1, PKA2, PKA3, PKA4|Random field a1, Random field a2|No|
[0092] job00bb|table_b|PKb1,PKb2|Random field b1|No|
[0093] job00bb|table_c|PKc1,PKc2|Random field c1|Yes|
[0094] After executing the job00bb task, the main processing node, according to the above configuration, extracts the values of the primary key fields PKa1, PKa2, PKa3, and PKa4, as well as the values of the random fields a1 and a2, from the second processing result of table_a; extracts the values of the primary key fields PKb1 and PKb2, as well as the value of the random field b1, from the second processing result of table_b; and extracts the values of the primary key fields PKc1 and PKc2, as well as the value of the random field c1, from the second processing result of table_c. Other non-random, non-primary key fields in each table are not extracted.
[0095] Similarly, for the file storage task list jobNAS.list, the configuration format is: "jobname|filename|whether asynchronous processing is allowed|". After the main processing node completes the job, it extracts the newly generated or modified individual files based on this configuration, rather than the entire directory.
[0096] Step S206: Synchronize the field information to the sub-processing node so that the sub-processing node can correct the field content of the target field in the first processing result based on the field information and obtain the corrected processing result.
[0097] The corrected processing result refers to the processing result obtained by the sub-processing node after receiving the field information synchronized by the main processing node, replacing the content of the target field in the first processing result with the corresponding field content in the second processing result of the main processing node. The corrected processing result and the second processing result are consistent in content, specifically meaning that the content of the target field in the corrected processing result is the same as the content of the corresponding field in the second processing result, while non-target fields are already the same because they are executed independently by each node.
[0098] For example, the main processing node sends the extracted target field information to the sub-processing nodes. Upon receiving the field information, the sub-processing node locates the corresponding record in its first processing result based on the record identifier (primary key field value) and updates the target field (random field) content in that record to the field content synchronized from the main processing node. Since non-target fields remain consistent when executed independently by each node, the corrected processing result of the sub-processing node is consistent in content with the second processing result of the main processing node.
[0099] For example, continuing with the job00bb example above. After the main processing node A completes the execution of job00bb, it needs to immediately push the synchronization data files to each sub-processing node. For tables_a and table_b, which are configured as "No", the main processing node A extracts the field information of the random target field in tables_a and table_b, and generates the corresponding synchronization data files:
[0100] / home / ap / nas / SYNCDB / dir1 / table_a_job00bb.dat
[0101] / home / ap / nas / SYNCDB / dir1 / table_b_job00bb.dat
[0102] These files are then sent to sub-processing nodes B, C, D, and E. Each sub-processing node has also completed the job00bb task locally, generating its first local processing result. When a sub-processing node executes the processing logic corresponding to this task, it checks whether it has received the real-time synchronization data file from the main processing node. Since this part is configured for real-time synchronization, the sub-processing node will not continue the subsequent process of this task if it has not received the synchronization data file, but will wait. After receiving the synchronization data file, the sub-processing node locates the corresponding business record in the local processing result according to the primary key field in the configuration, and only updates the content of the target field (random field) in the record to the value synchronized from the main processing node. For non-target fields, that is, ordinary business fields where the business logic is determined and each node can obtain a consistent result by executing locally, the sub-processing node does not make any changes and continues to retain the content obtained by its own local calculation. After completing the field update, the sub-processing node clears the processed synchronization data file. After this step, the target field in the first processing result of the sub-processing node is consistent with the second processing result of the main processing node; and the non-target fields are already consistent after being executed locally by each node. Finally, the correction processing result obtained by the sub-processing node is consistent with the content of the second processing result of the main processing node.
[0103] For the data object table_c configured as "Yes", the main processing node A extracts the field information of the randomness target field of table_c and generates an asynchronous data file:
[0104] / home / ap / nas / ASYNCDB / dir1 / table_c_job00bb.dat
[0105] The file is then placed in an asynchronous transmission queue, and the background push task `jobEXPORTDB` pushes the asynchronous data file to each sub-processing node (B, C, D, E) according to a preset period. Once the push is complete, the push status is marked as "completed." For sub-processing nodes, even if the asynchronous data file corresponding to `table_c` has not yet been received when the local `job00bb` task finishes execution, it will not block the completion of the current `job00bb` task; the task can execute successfully and exit directly without waiting for the asynchronous data to arrive. Subsequently, the background update task `jobUPDATEDB`, which runs independently on the sub-processing node side, will periodically scan. When it detects that the asynchronous data file for `table_c` has been received, it updates the target field corresponding to `table_c` in the local first processing result according to the configuration. After the update is complete, the corresponding asynchronous data file is cleared. This asynchronous update action lags behind the execution of the main `job00bb` task, ultimately completing the alignment of random target fields without blocking the batch main task process.
[0106] In addition to database table records, this embodiment also applies to the processing results of business file types. For example, jobNAS.list contains:
[0107] job00bb| / home / ap / nas / file / output / abcd / bb_0001|No|
[0108] job00bb| / home / ap / nas / file / output / abcd / bb_0002|is|
[0109] After the main processing node A completes the job00bb task, it differentiates between synchronous and asynchronous modes: Real-time synchronized business files are immediately distributed to each sub-processing node; asynchronously synchronized business files are pushed to each sub-processing node periodically by the background push task jobEXPORTFILE, and the status is marked as complete upon push completion. Sub-processing nodes executing the job00bb task locally will generate corresponding business files locally. For real-time synchronized business files, after receiving the real-time synchronized file from the main processing node, the sub-processing node directly updates the random target information portion of its local business file; for asynchronously synchronized business files, the sub-processing node does not need to wait for the asynchronous file after completing the job00bb task. The background update task jobUPDATENAS on the sub-processing node side updates the random portion of the local business file upon detecting the arrival of the asynchronous business file, and then clears the received synchronized file.
[0110] In some embodiments, after a sub-processing node completes the correction, it returns a correction completion status to the main processing node. The main processing node updates the synchronization record based on the correction completion status to confirm that the field information has been synchronized on the sub-processing nodes.
[0111] In this embodiment, the main processing node acquires the target task to be processed and sends it to the sub-processing nodes. Thus, the main processing node and the sub-processing nodes execute the same target task in parallel, each obtaining its corresponding processing result. When the main processing node obtains a second processing result by executing the target task, it only extracts the field information of the target field from the second processing result and synchronizes it to the sub-processing nodes. Since the target field is a random field that will produce deviations when different processing nodes execute the same task, while non-target fields are consistent when each node executes independently, synchronizing only the field information of the target field is sufficient to achieve consistency in the processing results of each node. Finally, the sub-processing nodes correct the field content of the target field in the first processing result based on the field information, obtaining a corrected processing result consistent with the content of the second processing result. Thus, this embodiment significantly reduces the amount of data synchronized between nodes, reduces dedicated line bandwidth overhead, and alleviates the read / write pressure on the main processing node, thereby effectively improving the information synchronization efficiency between nodes. Simultaneously, the reduced amount of synchronized data lowers the probability of data discrepancies, improving the consistency of multi-node processing results.
[0112] In one exemplary embodiment, such as Figure 3 As shown, the task processing method further includes steps S302 to S304, wherein:
[0113] Step S302: Execute the activity status detection task to obtain activity status information and synchronize the activity status information to the processing node.
[0114] The activity status information indicates whether the main processing node is currently active. Specifically, the activity status information can be a status flag, such as "normal and available" or "faulty and unavailable." The activity status information is generated by the main processing node performing a local liveness verification job according to a preset time period and synchronized to each sub-processing node.
[0115] For example, each processing node is configured with a local liveness check job, which checks its local activity status at fixed intervals (e.g., 5 minutes) and synchronizes the activity status information with other processing nodes along with the task status. For instance, the main processing node A is configured with a local liveness check job, which checks its local activity status every 5 minutes, generates activity status information such as "This node is normally available," and synchronizes this activity status information with processing nodes B, C, D, and E. Each processing node broadcasts its own liveness status to other processing nodes every 5 minutes through its local liveness check job.
[0116] Step S304: If the activity status information indicates that the main processing node is currently inactive, stop receiving external input data and stop outputting data to the outside world, and change the sub-processing node to the new main processing node.
[0117] Inactive status refers to a state where service cannot be provided normally. This is divided into two scenarios: First, the main processing node detects the fault and proactively generates "fault unavailable" status information, which is then sent to the sub-processing nodes. Simultaneously, the main processing node immediately stops receiving external input data and stops outputting data. Second, the main processing node completely crashes and stops sending any status messages. In this case, each sub-processing node continuously listens for the main processing node's status messages. If the duration of not receiving a status message from the main processing node exceeds a preset signal loss time threshold (e.g., 10 minutes), the main processing node is determined to be inactive.
[0118] For example, the system pre-maintains a node configuration list, which records the priority order of multiple processing nodes, for selecting a new primary processing node to upgrade in case of failure. When it is determined that the original primary processing node is inactive, the available secondary processing node with the highest priority is upgraded to the new primary processing node according to the priority order of the node configuration list, and related services for receiving external input data and outputting data are started.
[0119] For example, the priority order of the node configuration list is configured as "A|B|C|D|E", where A is the initial primary processing node. When primary processing node A actively reports a fault status, or if no status message is received from A for more than 10 consecutive minutes, the next highest priority sub-processing node B is promoted to the new primary processing node. B executes tasks according to the business logic of the primary processing node and starts external data transmission and reception services. If A, B, and C are all determined to be inactive, then sub-processing node D is promoted to the new primary processing node.
[0120] In this embodiment, by using the activity status detection task and automatic switching mechanism, the sub-processing node can be quickly upgraded to a new main processing node when the main processing node fails, ensuring the continuity of task processing services, reducing manual intervention, and improving the disaster recovery switching speed.
[0121] In one exemplary embodiment, such as Figure 4 As shown, the task processing method further includes steps S402 to S406, wherein:
[0122] Step S402: Upon recovery from an inactive state to an active state, receive synchronization information sent by the new master processing node.
[0123] Synchronization information refers to the data generated by the new master processing node during business takeover and sent to the recovered original master processing node. Synchronization information mainly includes field information of the target fields extracted by the new master processing node from its own processing results, used by the original master processing node for local data restoration. At this time, the original master processing node has completed fault recovery but has not yet resumed its master processing node role, still participating in processing as a regular node within the cluster.
[0124] For example, after the original primary processing node recovers from a failure, it receives synchronization information sent by the new primary processing node. For instance, after the original primary node A recovers from an inactive state to an active state, it receives synchronization information sent by the new primary node B. This synchronization information is an incremental synchronization file generated by the new primary node B during its takeover period, containing field information of the target fields extracted by node B from its own processing results. The original primary node A updates its local processing results based on this synchronization information, ensuring that its local processing results are consistent with the processing results of the new primary node B in content.
[0125] Step S404: Update the current processing result according to the synchronization information so that the current processing result of the main processing node is consistent with the processing result of the new main processing node in terms of content.
[0126] The original master processing node performs supplementary updates on the historical processing results stored locally based on the received synchronization information, only updating and correcting the random target fields, and retaining the non-target field content that has been calculated locally.
[0127] For example, the original primary processing node A reads the incremental synchronization file from B, and modifies the corresponding target fields in its local processing results line by line, referring to the field information of the target fields in the file. Non-target fields retain their original local calculation results without modification, ultimately ensuring that the processing results of A and the processing results of the new primary processing node B remain consistent.
[0128] Step S406: If the processing result is updated and the current task execution environment meets the node restoration conditions, restore it to the main processing node.
[0129] The node restoration conditions include multiple prerequisites that allow the original master processing node to revert to its primary role. These include, but are not limited to, at least one of the following: the node's hardware resources are functioning normally; the cluster network link communication is normal; the batch scheduling service environment is ready; and the local processing results have been aligned with the current cluster master node. Manual status verification and confirmation may also be included. Node restoration is not a mandatory process. Even if the conditions are met, the original master processing node can either be restored to the cluster's master processing node or it can be allowed to continue participating in cluster task processing only as a sub-processing node.
[0130] For example, after the original primary processing node A completes all updates and alignments of its local processing results, the system verifies the node restoration conditions, confirming that the hardware, network, and batch scheduling environment are all normal, and simultaneously performs a manual review of the node's running status. Once all conditions are met, A can be restored to the primary processing node of the cluster, or A can be automatically restored to the primary processing node, resuming its primary role in external data transmission and reception and batch tasks; alternatively, role restoration can be skipped, allowing A to continue to collaborate as a sub-processing node in executing tasks.
[0131] In this embodiment, through the incremental reverse recovery mechanism, after the faulty node is recovered, only the missing incremental data needs to be synchronized, without the need for full reconstruction, which greatly shortens the recovery time and reduces the bandwidth usage during the recovery process.
[0132] In one exemplary embodiment, such as Figure 5 As shown, the field information is synchronized to the sub-processing nodes so that the sub-processing nodes can correct the field content of the target field in the first processing result based on the field information, including steps S502 to S504, wherein:
[0133] Step S502: Obtain the synchronization mode identifier corresponding to the field information, and if the synchronization mode identifier indicates that asynchronous synchronization is allowed, store the field information in the asynchronous transmission queue.
[0134] The synchronization mode identifier indicates the synchronization method for the corresponding field information, including both asynchronous and real-time synchronization modes. The synchronization mode identifier can be preset according to configuration information, such as specifying the synchronization mode for each task or field in the configuration list. Specifically, in the jobDB.list and jobNAS.list configurations, the field "Can it be processed asynchronously?" is the synchronization mode identifier. When this field is "Yes", it indicates that asynchronous synchronization is allowed; when this field is "No", it indicates real-time synchronization.
[0135] For example, for field information that allows asynchronous synchronization, the main processing node stores it in an asynchronous transmission queue, waiting for periodic batch transmission. The asynchronous transmission queue can be set in the asynchronous transmission directory, distinct from the real-time synchronization directory.
[0136] For example, after the main processing node A finishes executing the job00bb task, for table_c which is configured as "yes", it stores the extracted field information to an asynchronous transmission queue (such as the / home / ap / nas / ASYNCDB / dir1 / directory).
[0137] Step S504: According to a preset time period, the field information in the asynchronous transmission queue is sent to the sub-processing node so that the sub-processing node can asynchronously correct the field content of the target field in the first processing result based on the field information.
[0138] For example, the main processing node sends the accumulated field information in the asynchronous transmission queue to the sub-processing nodes in batches according to a preset time period. For instance, the main processing node A uses the jobEXPORTDB job to periodically determine the asynchronous data file that needs to be pushed according to the list of completed jobs, and sends / home / ap / nas / ASYNCDB / dir1 / table_c_job00bb.dat to each sub-processing node. After the push is completed, the push status is marked as completed. After receiving the field information, sub-processing nodes B, C, D, and E update the field content of the target field in the first processing result through independent asynchronous update tasks (such as jobUPDATEDB), and clear the synchronization file after the update is completed.
[0139] In this embodiment, by using a timed batch sending method for field information that allows asynchronous synchronization, non-core data does not need to be synchronized immediately upon task completion, reducing the immediate occupation of the main processing node and network resources, and further reducing synchronization overhead.
[0140] In one exemplary embodiment, such as Figure 6 As shown, the task processing method further includes steps S602 to S604, wherein:
[0141] Step S602: When the synchronization mode identifier indicates real-time synchronization, store the field information in the synchronization transmission queue.
[0142] For example, for field information that needs to be synchronized in real time, the main processing node stores it in a synchronization transmission queue, waiting to be sent immediately. The synchronization transmission queue can be set in a synchronization transmission directory, distinct from the asynchronous transmission directory. For instance, after executing the job00bb task, the main processing node A stores the extracted field information for tables_a and table_b, which are configured as "No", in the synchronization transmission queue (e.g., the / home / ap / nas / SYNCDB / dir1 / directory).
[0143] Step S604: The field information in the synchronous transmission queue is sent to the sub-processing node in real time, so that the sub-processing node can correct the field content of the target field in the first processing result in real time based on the field information.
[0144] For example, after the target task is completed, the main processing node immediately sends the field information in the synchronization transmission queue to the sub-processing nodes. For instance, after job00bb is completed on main processing node A, it needs to immediately push the synchronization data file to each sub-processing node. After job00bb is completed on sub-processing nodes B, C, D, and E, they check whether they have received the synchronization data file pushed by the main processing node. If the configuration is real-time synchronization and the file has arrived, they immediately update the field content of the target field in the first processing result according to the file.
[0145] In this embodiment, by sending the field information in real time, strong consistency of the random target field is ensured across multiple nodes, thus meeting the needs of scenarios with high requirements for data consistency.
[0146] In one exemplary embodiment, such as Figure 7 As shown, the task processing method further includes steps S702 to S704, wherein:
[0147] Step S702: If the target task includes at least one subtask for generating external output data, execute the subtask and generate a task skip instruction for the subtask.
[0148] Outgoing data refers to data that needs to be sent outwards, such as at least one of the following: result files or notification messages. The task skip instruction is used to instruct the sub-processing node not to execute the corresponding subtask.
[0149] For example, during the execution of the target task, the main processing node identifies subtasks that contain data for generating external output. For instance, tasks recorded in the jobOUTPUT.list list are external output tasks that are executed only by the main processing node. The configuration format of jobOUTPUT.list is "jobname". Jobs in the jobOUTPUT.list list are executed only by the main processing node; other nodes skip them. The main processing node executes the subtask to generate external output data and simultaneously generates a task skip instruction for that subtask.
[0150] Step S704: Send the task skip instruction to the sub-processing node so that the sub-processing node does not execute the sub-task under the instruction of the task skip instruction.
[0151] For example, the main processing node sends a task skip instruction to the sub-processing nodes. After receiving the task skip instruction, the sub-processing nodes skip the corresponding subtasks during the execution of the target task and do not generate external output data, thereby avoiding multiple nodes repeatedly sending data externally.
[0152] For example, if five nodes A, B, C, D, and E all execute the target task locally, when they reach the job that outputs the result file (which is in jobOUTPUT.list): A executes the job and sends the result file out; B, C, D, and E skip the job and do not send it out. This ensures the uniqueness of the output data.
[0153] In this embodiment, the main processing node executes the output sub-task and instructs the sub-processing nodes to skip it, thus ensuring the uniqueness of the output data and avoiding data chaos caused by multiple nodes repeatedly sending data out.
[0154] In one specific embodiment, such as Figure 8 As shown, the complete implementation process of the task processing method includes the following stages:
[0155] Phase 1: Parallel Execution of Target Tasks and Extraction of Field Information. Node A acquires the batch target tasks to be processed (e.g., end-of-day batch job00bb) and sends them to nodes B, C, D, and E. The five nodes execute job00bb in parallel. After execution, nodes B, C, D, and E each obtain the first processing result (i.e., updated table records in their local databases and generated or modified file data in their local storage). After execution, node A obtains the second processing result and, according to the jobDB.list configuration, extracts the field information of the target fields from the second processing result. Specifically, it extracts the values of the primary key fields PKa1, PKa2, PKa3, and PKa4, and the values of the random fields a1 and a2 from table_a; it extracts the values of the primary key fields PKb1 and PKb2, and the value of the random field b1 from table_b; and it extracts the values of the primary key fields PKc1 and PKc2, and the value of the random field c1 from table_c. Non-random and non-primary key fields in each table are not extracted. Similarly, for file synchronization, node A extracts the newly generated or modified individual files bb_0001 and bb_0002 based on this configuration, rather than the entire directory.
[0156] Phase Two: Field Information Synchronization and Sub-processing Node Correction. Node A synchronizes the extracted field information to nodes B, C, D, and E. The synchronization process is differentiated based on the synchronization mode identifier: For tables_a and_b configured as "No" (real-time synchronization), node A stores the field information in the synchronization transmission queue (e.g., under the directory / home / ap / nas / SYNCDB / dir1 / ) and generates synchronization data files. These files are then immediately sent to nodes B, C, D, and E after job00bb is completed. After completing their respective job00bb processes, nodes B, C, D, and E check if they have received the synchronization data files pushed by node A. If the files have not yet arrived, the sub-nodes' job00bb waits for the files to arrive; upon receiving the files, the sub-nodes locate the corresponding records according to the primary key field in the configuration, update the content of the target field (random field) to the value synchronized from node A, and then clear the synchronization files. At this point, the content of the target field in the first processing result of the sub-nodes is consistent with the second processing result of node A. Since the non-target fields themselves are consistent, the correction processing result is consistent with the content of the second processing result. For table_c configured as "Yes" (allowing asynchronous synchronization), node A stores the field information in an asynchronous transmission queue (e.g., under the directory / home / ap / nas / ASYNCDB / dir1 / ). Using jobEXPORTDB, it periodically checks the list of completed tasks to determine which asynchronous data files need to be pushed, and sends these files to each sub-node. After the push is complete, the push status is marked as complete. After job00bb is completed on nodes B, C, D, and E, if the configuration is asynchronous and the file does not exist, the task exits successfully without waiting. Then, the background job jobUPDATEDB on the sub-node starts, reads the .dat file of table_c in the ASYNCDB directory, determines the table_c fields that need asynchronous updates according to the jobDB.list configuration, and clears the synchronous file after the update.
[0157] For file synchronization, bb_0001, configured as "No", will have node A immediately push / home / ap / nas / SYNCNAS / file / output / abcd / bb_0001 to all branch nodes after job00bb completes. For bb_0002, configured as "Yes", node A will periodically push / home / ap / nas / ASYNCNAS / file / output / abcd / bb_0002 to all branch nodes via jobEXPORTFILE. After branch nodes complete job00bb, they will immediately overwrite the files in the configured directory using SYNCNAS files. For asynchronous files, branch nodes' jobUPDATENAS, according to the jobNAS.list configuration, will determine which files need to be asynchronously overwritten upon receiving the synchronized files, overwrite them, and then clear the synchronized files.
[0158] Phase Three: Processing of Subtasks for External Output. In batch jobs, there are subtasks used to generate external output data. For example, jobOUTPUT.list is configured with the job name job00out, which is used to send the processing result file. When node A executes the target task, it identifies this subtask, executes it to generate the external output data, and generates a task skip instruction for this subtask, sending it to nodes B, C, D, and E. Upon receiving the task skip instruction, nodes B, C, D, and E skip this subtask during their own execution of the target task, without generating external output data. In this way, node A executes job00out and sends the result file; nodes B, C, D, and E directly skip this job and do not send it, ensuring the uniqueness of the external output data.
[0159] Phase Four: Activity Status Detection and Node Switching. Each node is configured with a local activity verification job, checking its local activity status every 5 minutes, generating activity status information (e.g., "This node is normally available" or "This node is faulty and unavailable"), and synchronizing this information with other nodes. Node A acts as the primary processing node and also has a cyclical check task. When this node is inactive, it stops transmitting and receiving data (i.e., it stops receiving external input data and stops outputting data). If node A's activity signal is missing for more than 10 minutes, node B is promoted to the new primary processing node according to the node configuration list "A|B|C|D|E", and starts transmitting and receiving data. Tasks on node B are processed according to the primary processing node logic, including executing external output sub-tasks and undertaking external service responsibilities. If the activity status of nodes A, B, and C is missing, node D is promoted to the new primary processing node.
[0160] After the switchover, the running status of the preceding node needs to be manually assessed. The current primary processing node (e.g., node B) pushes the incremental synchronization files generated during the takeover period back to the recovered preceding node (e.g., node A). After node A recovers from an inactive state to an active state, it receives synchronization information sent by node B (this synchronization information is the field information of the target field extracted by node B from its own processing results). Node A updates its local processing results based on this synchronization information, ensuring that its local processing results are consistent with those of node B. If the processing results are updated and the current task execution environment meets the node restoration conditions (e.g., manual confirmation that the preceding node is running normally), node A can be restored to the primary processing node or continue to run in the cluster as a sub-processing node.
[0161] Phase 5: High Availability Mechanism for External File Reception. For receiving external input files, the external transmission node in the main processing node starts its service to receive files, while other nodes stop their services. The upstream system configures a list of addresses for all nodes' external transmission nodes and retryes them in sequence: first send to A, if that fails, send to B, then to C. As long as one of the five nodes is active, the file will be delivered. Once the current main processing node (e.g., A) receives the file, it immediately broadcasts it to all other nodes (B, C, D, E) via its internal dedicated transmission node (Anode), ensuring global data consistency.
[0162] Phase Six: Synchronization Completion Status Confirmation. After the sub-processing node completes the correction of the target field content in the first processing result, it returns the correction completion status to the main processing node. The main processing node updates the synchronization record based on the correction completion status to confirm that the field information has been synchronized on the sub-processing node.
[0163] Through the above process, this embodiment realizes the parallel execution of batch tasks by multiple nodes, only synchronizing random field information that may produce deviations, which greatly reduces the amount of synchronized data, reduces dedicated line bandwidth overhead, reduces read pressure on the main processing node, and at the same time ensures the consistency of processing results of each node, and has the ability to automatically switch and recover quickly.
[0164] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages in other steps. It is understood that the steps in different embodiments can be freely combined as needed, and all non-contradictory solutions formed by such combinations are within the scope of protection of this application.
[0165] Based on the same inventive concept, this application also provides a task processing apparatus for implementing the task processing method described above. The solution provided by this apparatus is similar to the implementation scheme described in the above method; therefore, the specific limitations in one or more task processing apparatus embodiments provided below can be found in the limitations of the task processing method described above, and will not be repeated here.
[0166] In one exemplary embodiment, such as Figure 9 As shown, a task processing device 90 is provided, comprising:
[0167] The task distribution module 902 is used to obtain the target task to be processed and send the target task to the sub-processing node; the sub-processing node is used to execute the target task and obtain the first processing result.
[0168] The information extraction module 904 is used to extract field information of the target field from the second processing result obtained by executing the target task; the target field refers to the random field that will produce deviation when different processing nodes execute the same task.
[0169] The information synchronization module 906 is used to synchronize field information to the sub-processing nodes, so that the sub-processing nodes can correct the field content of the target field in the first processing result based on the field information to obtain the corrected processing result; the corrected processing result is consistent with the content of the second processing result.
[0170] In one embodiment, the device 90 further includes: a status detection module, used to perform an activity status detection task, obtain activity status information, and synchronize the activity status information to the sub-processing node, wherein the activity status information is used to characterize whether the main processing node is currently in an active state;
[0171] The service stop module is used to stop receiving external input data and stop outputting data when the activity status information indicates that the main processing node is currently inactive, and the sub-processing node is changed to the new main processing node.
[0172] In one embodiment, the device 90 further includes: a recovery receiving module, configured to receive synchronization information sent by a new master processing node when recovering from an inactive state to an active state; a result updating module, configured to update the current processing result according to the synchronization information so that the current processing result of the master processing node is consistent with the processing result of the new master processing node in content; and a node restoration module, configured to restore the node to the master processing node when the processing result update is completed and the current task execution environment meets the node restoration conditions.
[0173] In one embodiment, the information synchronization module 906 further includes: an asynchronous storage unit, used to obtain the synchronization mode identifier corresponding to the field information, and store the field information in an asynchronous transmission queue when the synchronization mode identifier indicates that asynchronous synchronization is allowed; and an asynchronous sending unit, used to send the field information in the asynchronous transmission queue to the sub-processing node according to a preset time period, so that the sub-processing node can asynchronously correct the field content of the target field in the first processing result based on the field information.
[0174] In one embodiment, the device 90 further includes: a real-time storage module, used to store field information in a synchronization transmission queue when the synchronization mode identifier indicates real-time synchronization; and a real-time sending module, used to send the field information in the synchronization transmission queue to the sub-processing node in real time, so that the sub-processing node can correct the field content of the target field in the first processing result in real time based on the field information.
[0175] In one embodiment, the apparatus 90 further includes: an instruction generation module, configured to execute the subtask and generate a task skip instruction for the subtask when the target task includes at least one subtask for generating external output data; and an instruction sending module, configured to send the task skip instruction to the sub-processing node so that the sub-processing node does not execute the subtask under the instruction of the task skip instruction.
[0176] The above modules can be embedded in the processor of the computer device in hardware form or independent of it, or they can be stored in the memory of the computer device in software form, so that the processor can call and execute the corresponding operations of the above modules.
[0177] In one exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 10 As shown, this computer device includes a processor, memory, input / output interfaces (I / O), and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores task processing data. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network connection. When the computer program is executed by the processor, it implements a task processing method.
[0178] Those skilled in the art will understand that Figure 10 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0179] In one exemplary embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described method embodiments.
[0180] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps in the above method embodiments.
[0181] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.
[0182] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, graphics processors, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.
[0183] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0184] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A task processing method, characterized in that, The method is applied to a main processing node, which is communicatively connected to at least one sub-processing node; the method includes: The target task to be processed is obtained and sent to the sub-processing node; the sub-processing node is used to execute the target task and obtain a first processing result. If a second processing result is obtained by executing the target task, the field information of the target field is extracted from the second processing result; the target field refers to a random field that will produce deviations when different processing nodes execute the same task. The field information is synchronized to the sub-processing node, so that the sub-processing node can correct the field content of the target field in the first processing result based on the field information to obtain a corrected processing result; the corrected processing result is consistent with the content of the second processing result.
2. The method according to claim 1, characterized in that, The method further includes: An activity status detection task is performed to obtain activity status information, and the activity status information is synchronized to the sub-processing node. The activity status information is used to characterize whether the main processing node is currently in an active state. When the activity status information indicates that the main processing node is currently inactive, it stops receiving external input data and stops outputting data, and the sub-processing node becomes the new main processing node.
3. The method according to claim 2, characterized in that, The method also includes Upon recovery from the inactive state to the active state, receive synchronization information sent by the new master processing node; The current processing result is updated according to the synchronization information so that the current processing result of the main processing node is consistent with the processing result of the new main processing node in terms of content. Once the processing results are updated and the current task execution environment meets the node restoration conditions, the node is restored to the main processing node.
4. The method according to claim 1, characterized in that, The step of synchronizing the field information to the sub-processing node, so that the sub-processing node can correct the field content of the target field in the first processing result based on the field information, includes: Obtain the synchronization mode identifier corresponding to the field information, and if the synchronization mode identifier indicates that asynchronous synchronization is allowed, store the field information in the asynchronous transmission queue; According to a preset time period, the field information in the asynchronous transmission queue is sent to the sub-processing node, so that the sub-processing node can asynchronously correct the field content of the target field in the first processing result based on the field information.
5. The method according to claim 4, characterized in that, The method further includes: When the synchronization mode identifier indicates real-time synchronization, the field information is stored in the synchronization transmission queue; The field information in the synchronous transmission queue is sent to the sub-processing node in real time, so that the sub-processing node can correct the field content of the target field in the first processing result in real time based on the field information.
6. The method according to claim 1, characterized in that, The method further includes: If the target task includes at least one subtask for generating external output data, execute the subtask and generate a task skip instruction for the subtask; The task skip instruction is sent to the sub-processing node so that the sub-processing node does not execute the sub-task under the instruction of the task skip instruction.
7. A task processing device, characterized in that, Applied to a main processing node, the main processing node being communicatively connected to at least one sub-processing node; the device includes: The task distribution module is used to obtain the target task to be processed and send the target task to the sub-processing node; the sub-processing node is used to execute the target task and obtain a first processing result. The information extraction module is used to extract field information of a target field from the second processing result obtained by executing the target task; the target field refers to a random field that will produce deviations when different processing nodes execute the same task. The information synchronization module is used to synchronize the field information to the sub-processing node, so that the sub-processing node can correct the field content of the target field in the first processing result based on the field information to obtain a corrected processing result; the corrected processing result is consistent with the content of the second processing result.
8. The apparatus according to claim 7, characterized in that, The device further includes: The status detection module is used to perform an activity status detection task, obtain activity status information, and synchronize the activity status information to the sub-processing node. The activity status information is used to characterize whether the main processing node is currently in an active state. The service stop module is used to stop receiving external input data and stop outputting data when the activity status information indicates that the main processing node is currently inactive, and the sub-processing node is changed to a new main processing node.
9. The apparatus according to claim 8, characterized in that, The device further includes: The recovery receiving module is used to receive synchronization information sent by the new master processing node when the system recovers from the inactive state to the active state. The result update module is used to update the current processing result according to the synchronization information so that the current processing result of the main processing node is consistent with the processing result of the new main processing node in terms of content. The node restoration module is used to restore the main processing node when the processing result has been updated and the current task execution environment meets the node restoration conditions.
10. The apparatus according to claim 7, characterized in that, The information synchronization module also includes: An asynchronous storage unit is used to obtain the synchronization mode identifier corresponding to the field information, and store the field information into an asynchronous transmission queue when the synchronization mode identifier indicates that asynchronous synchronization is allowed; An asynchronous sending unit is used to send the field information in the asynchronous transmission queue to the sub-processing node according to a preset time period, so that the sub-processing node can asynchronously correct the field content of the target field in the first processing result based on the field information.
11. The apparatus according to claim 7, characterized in that, The device further includes: A real-time storage module is used to store the field information to a synchronization transmission queue when the synchronization mode identifier indicates real-time synchronization. The real-time sending module is used to send the field information in the synchronous transmission queue to the sub-processing node in real time, so that the sub-processing node can correct the field content of the target field in the first processing result in real time based on the field information.
12. The apparatus according to claim 7, characterized in that, The device further includes: The instruction generation module is used to execute the subtask and generate a task skip instruction for the subtask when the target task includes at least one subtask for generating external output data. The instruction sending module is used to send the task skip instruction to the sub-processing node, so that the sub-processing node does not execute the sub-task under the instruction of the task skip instruction.
13. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.
14. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.
15. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.
