Real-time streaming data processing method, device, computer equipment and storage medium

By generating transaction numbers and dividing the pending streaming data into multiple data segments for parallel processing, Hudi's application program interface stores the processing results to the distributed file system, and performs transaction submission after all processing results are stored, which solves the problem of The problem of poor timeline deletion and modification of Hive lines has achieved the improvement of real-time file updates and real-time data processing efficiency of distributed file systems.

CN114691639BActive Publication Date: 2025-02-14SF TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202011641644.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-31
Publication Date
2025-02-14
Estimated Expiration
2040-12-31

AI Technical Summary

Technical Problem

In the prior art, the timeline deletion and modification of Hive is poor and real-time updates cannot be achieved.

Method used

By generating transaction numbers, obtaining pending streaming data from the data source, sending it to the computing node for processing, dividing it into multiple data segments, local cache and parallel processing, the processing results are stored in distribution using Hudi's application program interface and transaction commits after all processing results are stored.

Benefits of technology

Real-time update of files of distributed file systems is realized, real-time processing efficiency of data is improved, and the problem of poor timeline deletion and modification of Hive lines is solved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114691639B_ABST
    Figure CN114691639B_ABST
Patent Text Reader

Abstract

The present application provides a real-time streaming data processing method, device, computer equipment and storage medium. The method includes: obtaining the streaming data to be processed, generating a transaction number for the streaming data to be processed, sending the streaming data to be processed to at least one computing node, dividing it into multiple data segments, and processing the multiple data segments in parallel, storing the processing results of the parallel processing in a distributed file system through an interface of a data set storage management program based on the transaction number, and when all the processing results corresponding to the parallel processing are stored in the distributed file system, executing transaction submission for the streaming data to be processed, detecting the transaction submission initiated by each computing node for the streaming data to be processed, storing the relevant data based on the transaction number, and storing the processing results in the distributed file system through the interface of the data set storage management program, so as to realize the real-time update of the files of the distributed file system and improve the real-time processing efficiency of data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a real-time streaming data processing method, device, computer equipment and storage medium. Background Art

[0002] The underlying file storage of Hive is the distributed file system (HDFS). HDFS itself does not support row modification and deletion, which makes it difficult to delete and modify Hive rows.

[0003] In current technology, hive rows are usually deleted and modified offline with the help of MR or Spark, which has poor timeliness. Summary of the invention

[0004] Based on this, it is necessary to provide a real-time streaming data processing method, device, computer equipment and storage medium to address the technical problem of poor timeliness of deleting and modifying hives in the current technology.

[0005] A real-time streaming data processing method, the method comprising:

[0006] Acquire the streaming data to be processed from the data source, and generate a transaction number for the streaming data to be processed;

[0007] Sending the to-be-processed streaming data to at least one computing node for processing, each computing node being used to divide the to-be-processed streaming data into a plurality of data segments, locally caching the plurality of data segments based on the transaction number, and processing the plurality of locally cached data segments in parallel;

[0008] storing the processing results of the parallel processing in a distributed file system through an interface of a data set storage management program based on the transaction number, and when all the processing results corresponding to the parallel processing are stored in the distributed file system, executing transaction submission for the streaming data to be processed according to the transaction number and all the processing results;

[0009] Detect transaction submissions initiated by each of the computing nodes for the streaming data to be processed, and store relevant data corresponding to the transaction submissions based on the transaction number.

[0010] In one embodiment, after generating a transaction number for the streaming data to be processed, the method further includes:

[0011] The offset address offset corresponding to the to-be-processed streaming data in the data queue kafka of the data source is cached based on the transaction number.

[0012] In one embodiment, before locally caching the multiple data segments based on the transaction number, the method further includes:

[0013] Get the previous transaction number and the corresponding processing status from the cache module;

[0014] If the processing status of the previous transaction number is in an uncompleted state and the previous transaction number has timed out, control the previous transaction number to exit abnormally;

[0015] After the previous transaction number exits abnormally, or if the processing status of the previous transaction number is completed, the transaction number of the streaming data to be processed is used to update the previous transaction number in the cache module, and the local caching of the multiple data segments based on the transaction number is performed.

[0016] In one embodiment, the method further comprises:

[0017] If all processing tasks in the parallel processing are completed, executing transaction submission for the streaming data to be processed;

[0018] If any processing task in the parallel processing fails, all processing tasks in the parallel processing are reprocessed, and after all processing tasks in the parallel processing are reprocessed, a transaction submission for the streaming data to be processed is executed.

[0019] In one embodiment, the interface of the data set storage management program includes an application program interface of hudi; and the parallel processing of the multiple data segments cached locally includes:

[0020] For each of the computing nodes, if the data segment is empty data, storing the empty data as a processing result corresponding to the data segment in the distributed file system;

[0021] If the data segment is not empty data, the processing result corresponding to the data segment is stored in the distributed file system through the hudi application program interface.

[0022] In one embodiment, the method further comprises:

[0023] If the transaction submission fails, the transaction number and the corresponding processing status are obtained from the cache module;

[0024] If the processing status of the transaction number is completed, all processing results are obtained from the cache module based on the transaction number, and the transaction submission for the to-be-processed streaming data is re-executed.

[0025] In one embodiment, the method further comprises:

[0026] If the transaction is successfully submitted, the cache information corresponding to the transaction number is cleared.

[0027] A real-time streaming data processing device, the device comprising:

[0028] A transaction number generation module, used for acquiring the streaming data to be processed from the data source, and generating a transaction number for the streaming data to be processed;

[0029] A transaction processing module, used for sending the streaming data to be processed to at least one computing node for processing, each computing node is used for dividing the streaming data to be processed into a plurality of data segments, locally caching the plurality of data segments based on the transaction number, and processing the plurality of locally cached data segments in parallel;

[0030] A transaction submission module, configured to store the processing result of the parallel processing in a distributed file system through an interface of a data set storage management program based on the transaction number, and when all the processing results corresponding to the parallel processing are stored in the distributed file system, execute transaction submission for the streaming data to be processed according to the transaction number and all the processing results;

[0031] The storage module is used to detect the transaction submission initiated by each of the computing nodes for the streaming data to be processed, and store the relevant data corresponding to the transaction submission based on the transaction number.

[0032] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the real-time streaming data processing method in any of the above embodiments when executing the computer program.

[0033] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the real-time streaming data processing method in any of the above embodiments.

[0034] The above-mentioned real-time streaming data processing method, device, computer equipment and storage medium obtain the streaming data to be processed, generate a transaction number for the streaming data to be processed, send the streaming data to be processed to at least one computing node, divide it into multiple data segments, and process the multiple data segments in parallel. Based on the transaction number, the processing results of the parallel processing are stored in the distributed file system through the interface of the data set storage management program, and when all the processing results corresponding to the parallel processing are stored in the distributed file system, the transaction submission for the streaming data to be processed is executed, the transaction submission initiated by each computing node for the streaming data to be processed is detected, the relevant data of the transaction submission is stored based on the transaction number, and the processing results are stored in the distributed file system through the data set storage management program. Real-time update of files in the distributed file system can be achieved, and the real-time processing efficiency of data can be improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] Figure 1 An application environment diagram of a real-time streaming data processing method in one embodiment;

[0036] Figure 2 A schematic diagram of a flow chart of a real-time streaming data processing method in one embodiment;

[0037] Figure 3 A schematic diagram of a process flow of starting a transaction step in an embodiment;

[0038] Figure 4 A flowchart of a transaction opening step in another embodiment;

[0039] Figure 5 A flowchart of a transaction opening step in another embodiment;

[0040] Figure 6 A schematic diagram of a flow chart of executing transaction steps in an embodiment;

[0041] Figure 7 A schematic diagram of a flow chart of executing transaction steps in another embodiment;

[0042] Figure 8 A schematic diagram of a process of submitting a transaction in one embodiment;

[0043] Fig. 9 is a flowchart of a real-time streaming data processing method in another embodiment;

[0044] Fig.10 is a structural block diagram of a real-time streaming data processing device in one embodiment;

[0045] Fig.11 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0046] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0047] In the technology involved in this application, the data set storage management program can be a program for real-time acquisition and processing of data sets, and the processed data can be stored in the corresponding database through the program interface. The data set storage management program includes but is not limited to Hudi, Kudu, Hive Transactions, Hbase, Stream Processing, etc. Different data set management programs can be configured according to different data processing requirements. The following is an example of Hudi.

[0048] Hudi is an open source solution for Data Lakes that can ingest and manage large analytical data sets based on HDFS. Its main purpose is to efficiently reduce storage delays. It provides the following stream primitives on HDFS data sets: insert and update (how to change a data set); incremental pull (how to obtain changed data). It can insert / update data in parquet format on HDFS and implement data recovery through Savepoint. A data processing Pipeline usually consists of three parts: Source, Processing, and Sink. Hudi can be used as Source and Sink, and it stores data in HDFS.

[0049] Flink is a distributed processing engine and framework for stateful computation of bounded and unbounded data streams, that is, a stream computing framework, mainly used to process streaming data. There are two main processes involved in the Flink runtime:

[0050] JobManager: Mainly responsible for scheduling tasks, coordinating checkpoints and error recovery, etc. When the client submits the packaged task to the JobManager, the JobManager will assign the task to the TaskManager with resources based on the registered TaskManager resource information, and then start running the task. TaskManager obtains task information from the JobManager and then uses slot resources to run the task.

[0051] TaskManager: used to execute data flow tasks. A task may have multiple subtasks by setting the degree of parallelism. Each TaskManager can run as an independent process.

[0052] In this application, the data processing server can store real-time data in HDFS through the Flink checkpoint mechanism. By using the checkpoint mechanism, barriers are inserted into the streaming data to divide the streaming data into data segments. When executing transactions, the data segments can be written to HDFS through Hudi to improve the throughput of the transaction. In addition, the Flink checkpoint mechanism provides prepareSnapshotPreBarrier, snapshotState, and notifyCheckpointComplete callback methods. A Hudi transaction can be started through Flink checkpoint, and Hudi's execution transaction can be performed in snapshotState. The above solution can be as follows: Figure 1 As shown, each degree of parallelism of the tasks to be processed may be distributed on different computing nodes, each computing node may fail and require task recovery, and a fault-tolerant mechanism needs to be configured to ensure that data is not lost during data recovery.

[0053] In one embodiment, Figure 2 As shown, a real-time streaming data processing method is provided. This embodiment uses the method applied to a data processing server as an example. In this embodiment, the method includes the following steps:

[0054] Step S201: Obtain the streaming data to be processed from the data source, and generate a transaction number for the streaming data to be processed.

[0055] The data source may generate streaming data, and the transaction number of the streaming data to be processed may be used to identify the streaming data to be processed, thereby ensuring that the execution results of each successful parallel processing are completely collected when executing and submitting transactions.

[0056] In a specific implementation, the data processing server can obtain the streaming data to be processed from the subscription message queue (kafka) of the data source, and start a transaction number for the streaming data to be processed through the checkpoint mechanism.

[0057] Step S202, sending the streaming data to be processed to at least one computing node for processing, each computing node is used to divide the streaming data to be processed into multiple data segments, locally cache the multiple data segments based on transaction numbers, and parallelly process the multiple locally cached data segments.

[0058] The computing node may be a node in a data processing server for executing data processing tasks, and the computing node may divide the streaming data to be processed into multiple data segments according to barriers in the received streaming data to be processed.

[0059] In a specific implementation, the data processing server can send the acquired streaming data to be processed to at least one computing node for processing. Each computing node divides the data into multiple data segments and caches them locally according to the barriers in the streaming data to be processed. When executing a transaction, each computing node can obtain the transaction number corresponding to the transaction, and perform parallel processing on the multiple data segments cached locally to obtain the processing results corresponding to each parallel processing.

[0060] Step S203, based on the transaction number, the processing results of the parallel processing are stored in the distributed file system through the interface of the data set storage management program, and when all the processing results corresponding to the parallel processing are stored in the distributed file system, the transaction submission for the streaming data to be processed is executed according to the transaction number and all the processing results.

[0061] Among them, the data set storage management program can be used to store streaming data in HDFS after processing it on the data lake. Taking Hudi as an example, Hudi can realize real-time insertion and update of data, so that HDFS data sets support updates, and also support the incremental processing of this data set by downstream systems and query incremental changes at a certain point in time. Hudi's Application Programming Interface (API) can be used as a writing tool for Hudi to extract the corresponding data and store it in HDFS in real time. Transaction submission can be a submission process performed by the data processing server after collecting the processing results and transaction numbers of the parallel processing of each computing node, as well as other related data. When all the processing results of the parallel processing have been generated, the data processing server can execute the transaction submission for the streaming data to be processed.

[0062] In the specific implementation, the data processing server can obtain the processing results of each parallel processing based on the transaction number, extract the processing results through the data set storage management program interface and store them in HDFS, and submit the transaction for the streaming data to be processed according to the collected processing results of each parallel processing and the transaction number.

[0063] Step S204: Detect transaction submissions initiated by each computing node for the streaming data to be processed, and store relevant data corresponding to the transaction submissions based on the transaction number.

[0064] The relevant data corresponding to the transaction submission may include the transaction number, the processing result of the parallel processing, and the storage result of the HDFS, etc. The data processing server may store the relevant data in the corresponding cache module based on the transaction number, and the relevant data in the cache module may be deployed for fault recovery when a transaction submission failure occurs.

[0065] In a specific implementation, the data processing server can detect the transaction submission initiated by each node for the streaming data to be processed, and store the relevant data corresponding to the transaction submission of each computing node in the corresponding cache module based on the transaction number.

[0066] In the above-mentioned real-time streaming data processing method, by acquiring the streaming data to be processed, a transaction number is generated for the streaming data to be processed, the streaming data to be processed is sent to at least one computing node, divided into multiple data segments, and the multiple data segments are processed in parallel, and the processing results of the parallel processing are stored in the distributed file system through the interface of the data set storage management program based on the transaction number, and when all the processing results corresponding to the parallel processing are stored in the distributed file system, the transaction submission for the streaming data to be processed is executed, the transaction submission initiated by each computing node for the streaming data to be processed is detected, the relevant data of the transaction submission is stored based on the transaction number, and the processing results are stored in the distributed file system through the interface of the data set storage management program, so as to realize the real-time update of the files of the distributed file system and improve the real-time processing efficiency of data.

[0067] In one embodiment, the steps after determining in step S201 to generate a transaction number for the streaming data to be processed include:

[0068] The offset address offset of the streaming data to be processed in the data queue kafka of the data source is cached based on the transaction number.

[0069] In this embodiment, Kafka can be a high-throughput distributed publish-subscribe messaging system that can be used to process all action stream data of consumers on the website. As the source end of the real-time streaming data processing process, the data processing server can cache the offset address of Kafka based on the transaction number when executing checkpoint or savepoint.

[0070] When transaction recovery is required, the data processing server can obtain the offset address from the cache module and re-consume the corresponding data. This mechanism ensures that the data on the source side is not lost.

[0071] The solution of the above embodiment improves the accuracy of source-side data during transaction recovery by caching the offset address offset corresponding to the to-be-processed streaming data in the data queue kafka of the data source.

[0072] In one embodiment, Figure 3 As shown, the step of determining to locally cache the multiple data segments based on the transaction number in step S202 includes:

[0073] Step S301, obtaining the last transaction number and the corresponding processing status from the cache module;

[0074] The cache module can be a module in the data processing server for storing transaction numbers, processing results of each parallel processing, and processing status of transaction numbers. It can also store the offset address offset corresponding to the data queue kafka of the data source for the streaming data to be processed, the relevant data corresponding to the transaction submission of each computing node, and the storage results of hdfs. The processing status of the transaction number can include completed status and incomplete status. The data processing server can obtain the previous transaction number and the corresponding processing status from the cache module.

[0075] Step S302: If the processing status of the previous transaction number is in an uncompleted state and the previous transaction number has timed out, the previous transaction number is controlled to exit abnormally.

[0076] If the processing status of the previous transaction number is not completed, the data processing server can call back the prepareSnapshotPreBarrier method when starting a checkpoint and determine whether the transaction number has timed out. If so, the previous transaction number can be controlled to exit abnormally.

[0077] In some embodiments, if the previous transaction number has not been processed before the timeout, the data processing server can control the program to sleep for a preset period of time, such as 1 second, and re-obtain the processing status of the previous transaction number, and perform the timeout judgment step again.

[0078] Step S303, after the previous transaction number exits abnormally, or if the processing status of the previous transaction number is completed, the transaction number of the streaming data to be processed is used to update the previous transaction number in the cache module, and local caching of multiple data segments is performed based on the transaction number.

[0079] In this embodiment, after the control of the previous transaction number abnormally exits, or the processing status of the previous transaction number is completed, the data processing server can generate a new transaction number for the streaming data to be processed through the checkpoint mechanism, and update the previous transaction number in the cache module to the transaction number of the streaming data to be processed, thereby realizing the process of starting the transaction operator. The data processing server can locally cache multiple data segments in each computing node based on the transaction number.

[0080] In some embodiments, Figure 4-5 As shown, the data processing server can obtain the previous transaction number and store it in the cache module, so that when the transaction operator task failure recovery is enabled, the processing status of the previous transaction number is obtained from the cache module. If the previous transaction number is in an unfinished state, the previous transaction number in the memory module is updated to the current transaction number.

[0081] The scheme of the above-mentioned embodiment obtains the processing status of the previous transaction number, and when the previous transaction number is in the completed state or exits abnormally, starts the transaction number of the streaming data to be processed, thereby avoiding data loss, improving the effectiveness of streaming data processing, and further improving the effectiveness of fault recovery.

[0082] In one embodiment, the method further includes:

[0083] Step S401: If all processing tasks in the parallel processing are completed, a transaction submission for the streaming data to be processed is executed.

[0084] After the processing tasks of each computing node are completed and stored in HDFS through the interface of the data set storage management program, each computing node can send one or more of the execution data such as the transaction number, the processing results of parallel processing, and the storage results of HDFS to the downstream node, where the downstream node can be the transaction submission operator. The transaction submission operator can collect the above execution data of each computing node, and when all the data corresponding to the transaction number has been collected, it can initiate the transaction submission for the streaming data to be processed.

[0085] Step S402: if any processing task in the parallel processing fails, all processing tasks in the parallel processing are reprocessed, and after all processing tasks in the parallel processing are reprocessed, a transaction commit for the streaming data to be processed is executed.

[0086] If a processing task of any computing node fails during parallel processing, the data processing server needs to start task failure recovery. The data processing server can obtain the transaction number from the cache module. If the processing status of the transaction number is completed, it does not need to be reprocessed. If the processing status of the transaction number is incomplete, all processing tasks in parallel processing need to be reprocessed, and after all processing tasks are reprocessed, the transaction submission for the streaming data to be processed is executed.

[0087] The solution of the above-mentioned embodiment executes the transaction submission process when all processing tasks in parallel processing have been completed. If any processing task fails, all processing tasks in parallel processing are reprocessed, thereby improving the effectiveness of streaming data processing and further improving the effectiveness of fault recovery.

[0088] In one embodiment, Figure 6 As shown, the interface of the data set storage management program may be an application program interface of hudi, and the step of performing parallel processing on the multiple data segments cached locally in step S202 includes:

[0089] Step S401, for each computing node, if the data segment is empty data, the empty data is stored in the distributed file system as the processing result corresponding to the data segment.

[0090] When executing a transaction, the data processing server can call the snapshotState method of each computing node. In snapshotState, the processing results of parallel processing of multiple data segments are stored in HDFS using the hudi API, and the storage results of HDFS are fed back to the computing node, and the transaction number and the processing results of parallel processing are sent to the downstream node, such as submitting the transaction operator. When performing parallel processing, the data processing server can perform data judgment on multiple data segments cached locally. If the data segment is empty data, the empty data is stored in HDFS as the processing result corresponding to the data segment.

[0091] In some embodiments, if the data segment is empty data, the data processing server can also obtain the transaction number corresponding to the data segment from the cache module. If the transaction number is a valid transaction number, the empty data will be sent to the downstream node to make up the number, or the empty data can be stored in HDFS as the processing result corresponding to the data segment.

[0092] Step S402: If the data segment is not empty data, the processing result corresponding to the data segment is stored in the distributed file system through the hudi application program interface.

[0093] If the data segment of the computing node is not empty data, the data processing server can process the data segment through the processing task of the computing node to obtain the processing result, and store the processing result in HDFS through the Hudi application program interface.

[0094] In some embodiments, if the operation of huid storing the processing results to hdfs is successful, each computing node can send the transaction number and the processing results of the parallel processing to the downstream node, and send the transaction number and the processing results of the parallel processing to the cache module corresponding to the transaction number for storage. If the operation of hudi storing the processing results to hdfs fails, an abnormal signal is issued and the checkpoint process is exited.

[0095] In some embodiments, each computing node may also send the transaction number, the processing results of parallel processing, and the storage results of HDFS to the downstream node, and send the transaction number, the processing results of parallel processing, and the storage results of HDFS to the cache module corresponding to the transaction number for storage.

[0096] The solution of the above embodiment determines the corresponding data storage and sending mode to the downstream node according to whether the data segment is empty data, thereby improving the accuracy of streaming data processing.

[0097] In one embodiment, Figure 7 As shown, the above method also includes:

[0098] If a transaction submission fails, the transaction number and the corresponding processing status are obtained from the cache module; if the processing status of the transaction number is completed, all processing results are obtained from the cache module based on the transaction number, and the transaction submission for the streaming data to be processed is re-executed.

[0099] In this embodiment, transaction submission can be executed through the transaction submission operator. The transaction submission operator can continuously collect and cache the data sent by each computing node. Each time a piece of data is collected, it can be determined whether the processing result of the parallel processing corresponding to the transaction number is completely collected. If it has been completely collected, the transaction submission of the transaction number and processing result of the streaming data to be processed is executed. If the transaction submission operator fails, the data processing server needs to start fault recovery. The data processing server can obtain the transaction number from the cache module. If the processing status of the transaction number is completed, all processing results are obtained from the cache module based on the transaction number, and the transaction submission for the streaming data to be processed is re-executed based on the transaction number and all processing results.

[0100] The solution of the above embodiment, when a transaction submission failure occurs, obtains all processing results corresponding to the transaction number from the cache module, and re-executes the transaction submission for the streaming data to be processed, thereby improving the accuracy and efficiency of data recovery.

[0101] In one embodiment, Figure 8 As shown, the above method also includes:

[0102] If the transaction is submitted successfully, clear the cache information corresponding to the transaction number.

[0103] In this embodiment, when a transaction is submitted for a transaction number, the processing task corresponding to the computing node may fail to execute, resulting in failure to send data to the downstream node. Although other computing nodes send data, the downstream node cannot execute the transaction submission because all processing tasks processed in parallel have not been fully collected, resulting in cached data. If the transaction corresponding to the transaction number is successfully submitted, the data processing server can clear the cache information corresponding to the transaction number in the cache module to improve the efficiency of memory usage.

[0104] In one embodiment, Fig. 9 As shown, a real-time streaming data processing method is provided, the method comprising:

[0105] Step S901: Obtain the streaming data to be processed from the data source, and generate a transaction number for the streaming data to be processed.

[0106] Step S902: Send the streaming data to be processed to at least one computing node for processing, and each computing node is used to divide the streaming data to be processed into multiple data segments.

[0107] Step S903, obtain the previous transaction number and the corresponding processing status from the cache module; if the processing status of the previous transaction number is an incomplete state and the previous transaction number has timed out, control the previous transaction number to exit abnormally; after the previous transaction number exits abnormally, or if the processing status of the previous transaction number is a completed state, use the transaction number of the streaming data to be processed to update the previous transaction number in the cache module, and locally cache multiple data segments based on the transaction number.

[0108] Step S904, based on the transaction number, stores the processing results of the parallel processing in the distributed file system through the hudi application program interface, including: parallel processing of multiple data segments cached locally; for each computing node, if the data segment is empty data, storing the empty data as the processing result corresponding to the data segment in the distributed file system; if the data segment is not empty data, storing the processing result corresponding to the data segment in the distributed file system through the hudi application program interface.

[0109] Step S905, when all processing results corresponding to the parallel processing are stored in the distributed file system, execute transaction submission for the streaming data to be processed according to the transaction number and all processing results; detect the transaction submission initiated by each computing node for the streaming data to be processed, and store the relevant data corresponding to the transaction submission based on the transaction number.

[0110] Step S906, if a transaction submission failure occurs, obtain the transaction number and the corresponding processing status from the cache module; if the processing status of the transaction number is completed, obtain all processing results from the cache module based on the transaction number, and re-execute the transaction submission for the streaming data to be processed; if the transaction submission is successful, clear the cache information corresponding to the transaction number.

[0111] In the above embodiment, the streaming data to be processed is obtained from the data source, a transaction number is generated, the streaming data to be processed is sent to at least one computing node for processing, the streaming data to be processed is divided into multiple data segments, and processed in parallel by different computing nodes, and the processing results of the parallel processing are stored in the distributed file system through the hudi application program interface, and the transaction is submitted according to the transaction number and all processing results, and the response measures for transaction submission failures and the solution for clearing the cache information of the transaction number after the transaction is successfully submitted are given. By storing the processing results in the distributed file system through hudi, the real-time processing efficiency of streaming data can be improved, and the relevant data can be cached in each transaction stage so that it can be called during fault recovery, which further improves the effectiveness of fault recovery.

[0112] It should be understood that although Figure 2-9 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2-9 At least part of the steps may include multiple steps or multiple stages. These steps or stages are not necessarily performed at the same time, but can be performed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed in turn or alternately with other steps or at least part of the steps or stages in other steps.

[0113] In one embodiment, Fig.10 As shown, a real-time streaming data processing device is provided, and the device 1000 includes:

[0114] The transaction number generating module 1001 is used to obtain the streaming data to be processed from the data source, and generate a transaction number for the streaming data to be processed.

[0115] The transaction processing module 1002 is used to send the streaming data to be processed to at least one computing node for processing, each computing node is used to divide the streaming data to be processed into multiple data segments, locally cache the multiple data segments based on the transaction number, and parallelly process the multiple locally cached data segments.

[0116] The transaction submission module 1003 is used to store the processing results of the parallel processing in a distributed file system through the interface of the data set storage management program based on the transaction number, and when all the processing results corresponding to the parallel processing are stored in the distributed file system, execute the transaction submission for the streaming data to be processed according to the transaction number and the all processing results.

[0117] The storage module 1004 is used to detect the transaction submission initiated by each of the computing nodes for the streaming data to be processed, and store the relevant data corresponding to the transaction submission based on the transaction number.

[0118] In one embodiment, the transaction number generation module 1001 further includes: an offset address caching unit, which is used to cache the offset address offset corresponding to the to-be-processed streaming data in the data queue kafka of the data source based on the transaction number.

[0119] In one embodiment, the transaction processing module 1002 includes: a processing status unit, which is used to obtain a previous transaction number and a corresponding processing status from a cache module; if the processing status of the previous transaction number is a non-completed state and the previous transaction number has timed out, control the previous transaction number to exit abnormally; after the previous transaction number exits abnormally, or if the processing status of the previous transaction number is a completed state, use the transaction number of the streaming data to be processed to update the previous transaction number in the cache module, and execute the local caching of the multiple data segments based on the transaction number.

[0120] In one embodiment, the transaction processing module 1002 also includes: a parallel processing unit, which is used to execute transaction submission for the streaming data to be processed if all processing tasks in the parallel processing are completed; if any processing task in the parallel processing fails, all processing tasks in the parallel processing are reprocessed, and after all processing tasks in the parallel processing are reprocessed, the transaction submission for the streaming data to be processed is executed.

[0121] In one embodiment, the interface of the data set storage management program includes a hudi application program interface, a transaction processing module 1002, and also includes: a hudi storage unit, which is used for storing the empty data as the processing result corresponding to the data segment in the distributed file system for each of the computing nodes if the data segment is empty data; if the data segment is not empty data, storing the processing result corresponding to the data segment in the distributed file system through the hudi application program interface.

[0122] In one embodiment, the above-mentioned device 1000 also includes: a transaction submission failure module, which is used to obtain the transaction number and the corresponding processing status from the cache module if the transaction submission fails; if the processing status of the transaction number is a completed state, obtain the entire processing results from the cache module based on the transaction number, and re-execute the transaction submission for the streaming data to be processed.

[0123] In one embodiment, the apparatus 600 further includes: a cache information cleaning module, configured to clean up cache information corresponding to the transaction number if the transaction is successfully submitted.

[0124] For the specific definition of the real-time streaming data processing device, please refer to the definition of the real-time streaming data processing method above, which will not be repeated here. Each module in the above-mentioned real-time streaming data processing device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0125] The real-time streaming data processing method provided by the present application can be applied to a computer device, which can be a server, and its internal structure diagram can be as shown in Fig.11 As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store streaming data. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a real-time streaming data processing method is implemented.

[0126] Those skilled in the art will understand that Fig.11The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0127] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.

[0128] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.

[0129] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).

[0130] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, 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 specification.

[0131] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

Claims

1. A real-time streaming data processing method, characterized in that: The method comprises: Acquire the streaming data to be processed from the data source, and generate a transaction number for the streaming data to be processed; Sending the to-be-processed streaming data to at least one computing node for processing, each computing node being used to divide the to-be-processed streaming data into a plurality of data segments, locally caching the plurality of data segments based on the transaction number, and processing the plurality of locally cached data segments in parallel; storing the processing results of the parallel processing in a distributed file system through an interface of a data set storage management program based on the transaction number, and when all the processing results corresponding to the parallel processing are stored in the distributed file system, executing transaction submission for the streaming data to be processed according to the transaction number and all the processing results; Detect transaction submissions initiated by each of the computing nodes for the streaming data to be processed, and store relevant data corresponding to the transaction submissions based on the transaction number.

2. The method according to claim 1, characterized in that After generating a transaction number for the stream data to be processed, the method further includes: The offset address offset corresponding to the to-be-processed streaming data in the data queue kafka of the data source is cached based on the transaction number.

3. The method according to claim 1, characterized in that: Before locally caching the multiple data segments based on the transaction number, the method further includes: Get the previous transaction number and the corresponding processing status from the cache module; If the processing status of the previous transaction number is in an uncompleted state and the previous transaction number has timed out, control the previous transaction number to exit abnormally; After the previous transaction number exits abnormally, or if the processing status of the previous transaction number is completed, the transaction number of the streaming data to be processed is used to update the previous transaction number in the cache module, and the local caching of the multiple data segments based on the transaction number is performed.

4. The method according to claim 3, characterized in that The method further comprises: If all processing tasks in the parallel processing are completed, executing transaction submission for the streaming data to be processed; If any processing task in the parallel processing fails, all processing tasks in the parallel processing are reprocessed, and after all processing tasks in the parallel processing are reprocessed, a transaction submission for the streaming data to be processed is executed.

5. The method according to claim 1, characterized in that The interface of the data set storage management program includes an application program interface of hudi; the parallel processing of the multiple data segments cached locally includes: For each of the computing nodes, if the data segment is empty data, storing the empty data as a processing result corresponding to the data segment in the distributed file system; If the data segment is not empty data, the processing result corresponding to the data segment is stored in the distributed file system through the hudi application program interface.

6. The method according to claim 1, characterized in that The method further comprises: If the transaction submission fails, the transaction number and the corresponding processing status are obtained from the cache module; If the processing status of the transaction number is completed, all processing results are obtained from the cache module based on the transaction number, and the transaction submission for the to-be-processed streaming data is re-executed.

7. The method according to any one of claims 1 to 6, characterized in that: The method further comprises: If the transaction is successfully submitted, the cache information corresponding to the transaction number is cleared.

8. A real-time streaming data processing device, characterized in that: The device comprises: A transaction number generation module, used for acquiring the streaming data to be processed from the data source, and generating a transaction number for the streaming data to be processed; A transaction processing module, used for sending the streaming data to be processed to at least one computing node for processing, each computing node is used for dividing the streaming data to be processed into a plurality of data segments, locally caching the plurality of data segments based on the transaction number, and processing the plurality of locally cached data segments in parallel; A transaction submission module, configured to store the processing result of the parallel processing in a distributed file system through an interface of a data set storage management program based on the transaction number, and when all the processing results corresponding to the parallel processing are stored in the distributed file system, execute transaction submission for the streaming data to be processed according to the transaction number and all the processing results; The storage module is used to detect the transaction submission initiated by each of the computing nodes for the streaming data to be processed, and store the relevant data corresponding to the transaction submission based on the transaction number.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Streaming data processing method and device, computer equipment and storage medium

    CN110609852A

  • Transactional operations in multi-master distributed data management systems

    US20190265891A1