Database table aggregation method, device and equipment and computer readable storage medium

By obtaining task configuration information and running target synchronization services, real-time and full synchronization mechanisms are used to solve the difficulty and efficiency problems of aggregation service maintenance in network applications, and achieve efficient data aggregation and stability.

CN118779374AActive Publication Date: 2024-10-15INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410936103.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-12
Publication Date
2024-10-15
Estimated Expiration
2044-07-12

AI Technical Summary

Technical Problem

In network applications, as the source database table expands, the difficulty of maintaining the aggregation service increases sharply, and the data aggregation efficiency is difficult to guarantee, especially when a large number of aggregation tasks are frequently called.

Method used

By obtaining the mapping rules in the task configuration information, the target aggregation task is determined, and the target synchronization service is run. Real-time synchronization and full synchronization mechanisms are adopted. Real-time synchronization is used for real-time synchronization of data change information, and full synchronization is used when preset conditions are met. Data information synchronization reduces the difficulty of creating and maintaining aggregation tasks.

Benefits of technology

It realizes the creation of configured aggregation tasks, reduces the difficulty of maintaining aggregation services, improves the efficiency and stability of aggregation tasks, and meets the data synchronization needs of various practical work scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118779374A_ABST
    Figure CN118779374A_ABST
Patent Text Reader

Abstract

The invention relates to a database table aggregation method, device and equipment and a computer readable storage medium, and the method comprises the steps: obtaining task configuration information which comprises a plurality of mapping rules; according to a target mapping rule in the multiple mapping rules, a target aggregation task is determined, and the target aggregation task represents that data of at least one target source table is aggregated into a target aggregation table; for the target aggregation task, a target synchronization service is run, the target synchronization service comprises a first synchronization mechanism and a second synchronization mechanism, the first synchronization mechanism is used for synchronizing data change information of the target source table into the target aggregation table in real time, and the second synchronization mechanism is used for synchronizing the data change information of the target source table into the target aggregation table when a preset condition is met. And synchronizing the total data information of the target source table to the target aggregation table. According to the technical scheme provided by one or more embodiments of the invention, the aggregation service can be effectively maintained, and the data aggregation efficiency can be ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the technical field of computer data processing, and in particular to a database table aggregation method, device, equipment and computer-readable storage medium. Background Art

[0002] In the process of developing network applications, we often encounter functional requirements such as global search, data overview, business reports, etc. These functional requirements have a similar point: a series of data needs to be classified and aggregated, that is, the data from multiple database tables are converted into models and inserted into an aggregate table for subsequent business use.

[0003] To implement these aggregation operations, you can use the aggregation service to read and transform the data in the source database table, and then insert the transformed data into the new database table. The workload of the aggregation service is generally proportional to the amount of data in the source database table. In addition, as the source database table expands, it is usually necessary to add new data transformation logic to the aggregation service.

[0004] Therefore, when there are a large number of aggregation tasks (for example, global search, data overview, business reports and other functions are frequently called), the difficulty of maintaining the aggregation service increases sharply and the data aggregation efficiency is difficult to guarantee. Summary of the invention

[0005] In view of this, one or more embodiments of the present disclosure provide a database table aggregation method, apparatus, device, and computer-readable storage medium, which can effectively maintain aggregation services and ensure data aggregation efficiency.

[0006] On the one hand, the present disclosure provides a database table aggregation method, the method comprising: acquiring task configuration information, the task configuration information comprising a plurality of mapping rules; determining a target aggregation task according to a target mapping rule among the plurality of mapping rules, the target aggregation task representing aggregating data of at least one target source table into a target aggregation table; and running a target synchronization service for the target aggregation task, the target synchronization service comprising a first synchronization mechanism and a second synchronization mechanism, the first synchronization mechanism being used to synchronize data change information of the target source table to the target aggregation table in real time, and the second synchronization mechanism being used to synchronize all data information of the target source table to the target aggregation table when a preset condition is met.

[0007] On the other hand, the present disclosure further provides a database table aggregation device, the device comprising: an acquisition unit, used to acquire task configuration information, the task configuration information comprising multiple mapping rules; a management unit, used to determine a target aggregation task according to a target mapping rule among the multiple mapping rules, the target aggregation task represents aggregating data from at least one target source table into a target aggregation table; a synchronization unit, used to run a target synchronization service for the target aggregation task, the target synchronization service comprising a first synchronization mechanism and a second synchronization mechanism, the first synchronization mechanism being used to synchronize data change information of the target source table to the target aggregation table in real time, and the second synchronization mechanism being used to synchronize all data information of the target source table to the target aggregation table when a preset condition is met.

[0008] On the other hand, the present disclosure further provides an electronic device, which includes a memory and a processor, wherein the memory is used to store a computer program, and when the computer program is executed by the processor, the above-mentioned database table aggregation method is implemented.

[0009] On the other hand, the present disclosure further provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store a computer program, and when the computer program is executed by a processor, the above-mentioned database table aggregation method is implemented.

[0010] The technical solution provided by one or more embodiments of the present disclosure allows users to create aggregation tasks in a configurable manner, which can reduce the difficulty of creating aggregation tasks. According to multiple mapping rules, different aggregation tasks can be created respectively to complete the data synchronization function from the source database table to the aggregation table. Mutually independent aggregation tasks can reduce the difficulty of maintaining the aggregation service.

[0011] The technical solution provided by one or more embodiments of the present disclosure can run a corresponding target synchronization service when it comes to target aggregation tasks. The target synchronization service can include two synchronization mechanisms: real-time synchronization and full synchronization. The mutual cooperation of the two synchronization mechanisms enables the target synchronization service to meet a variety of actual work scenarios and improve the efficiency and stability of the aggregation tasks. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] The features and advantages of the present disclosure will be more clearly understood by referring to the accompanying drawings, which are schematic and should not be construed as limiting the present disclosure in any way. In the accompanying drawings:

[0013] Figure 1 The following is a diagram showing the steps of a database table aggregation method in one embodiment of the present disclosure;

[0014] Figure 2 A schematic diagram of a process flow of a real-time synchronization mechanism in one embodiment of the present disclosure is shown;

[0015] Figure 3 A schematic diagram of the process flow of a full synchronization mechanism in one embodiment of the present disclosure is shown;

[0016] Figure 4 A schematic diagram of a process flow of a full synchronization event in one embodiment of the present disclosure is shown;

[0017] Figure 5 A schematic diagram showing the composition structure of an automated aggregation program in one embodiment of the present disclosure is shown;

[0018] Figure 6 A functional schematic diagram of an automated aggregation procedure in one embodiment of the present disclosure is shown;

[0019] Figure 7 A schematic diagram showing the scheduling relationship of synchronization services in one embodiment of the present disclosure is shown;

[0020] Figure 8 A schematic diagram of functional units of a database table aggregation device in one embodiment of the present disclosure is shown;

[0021] Fig. 9 A schematic structural diagram of an electronic device in one embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0022] In order to make the purpose, technical solutions and advantages of the embodiments of the present disclosure clearer, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present disclosure.

[0023] See also Figure 1 , a database table aggregation method provided by an embodiment of the present disclosure may include the following steps.

[0024] S1: Obtain task configuration information, where the task configuration information includes a plurality of mapping rules.

[0025] In this embodiment, in order to complete the data aggregation operation, it is necessary to establish a mapping relationship between the source database table and the aggregation table. Through the task configuration information, both the source database table information and the aggregation table information can be provided, and the mapping rules between the source database table and the aggregation table can also be provided.

[0026] In this embodiment, multiple mapping rules can be obtained through configuration information. Each mapping rule can correspond to an aggregation task. It should be noted that different mapping rules can involve the same source database table. However, for the same source database table, different mapping rules may select data in different ranges in the source database table, and may indicate different data conversion rules for the same data in the source database table.

[0027] In this embodiment, obtaining task configuration information may be receiving configuration text input by a user, reading configuration parameters transmitted by a user, or parsing configuration commands issued by a user. Depending on the actual application scenario, the method for obtaining task configuration information is not specifically limited.

[0028] S2: Determine a target aggregation task according to a target mapping rule among the plurality of mapping rules, where the target aggregation task represents aggregating data of at least one target source table into a target aggregation table.

[0029] In this embodiment, a specific target aggregation task can be determined for a specific target mapping rule. Each target aggregation task can be maintained and managed independently. For example, a target aggregation task among multiple aggregation tasks can be established, modified, suspended, started, and deleted without affecting the status of other aggregation tasks.

[0030] In some implementations, a control instruction may be obtained. According to the control instruction, multiple target aggregation tasks may be managed in batches, or a certain target aggregation task may be managed in a customized manner.

[0031] S3: For the target aggregation task, run the target synchronization service, which includes a first synchronization mechanism and a second synchronization mechanism. The first synchronization mechanism is used to synchronize the data change information of the target source table to the target aggregation table in real time, and the second synchronization mechanism is used to synchronize the data information of the target source table to the target aggregation table in full when the preset conditions are met.

[0032] In this embodiment, a target synchronization service may be run for each target aggregation task. Any target synchronization service may have a first synchronization mechanism and a second synchronization mechanism, which respectively perform real-time synchronization and full synchronization of data.

[0033] It should be noted that the target synchronization service has the first synchronization mechanism and the second synchronization mechanism, which means that two data synchronization functions can be completed, and it does not limit the target synchronization service to execute these two synchronization mechanisms at the same time. According to actual needs, the execution logic of the synchronization mechanism can be customized for each target aggregation task. For example, the first synchronization mechanism and the second synchronization mechanism can be executed alternately; one synchronization mechanism can be executed continuously and the other synchronization mechanism can be executed periodically; or only the first synchronization mechanism or the second synchronization mechanism can be executed.

[0034] In this embodiment, the target synchronization service can be set when or after the target aggregation task is created. When setting the target synchronization service, the parameter information in the task configuration information can be called, such as real-time scheduling delay, real-time scheduling queue length, full scheduling cycle, cache queue length and other parameters.

[0035] In some implementations, when the target aggregation task is managed and modified, the target synchronization service may be managed and modified accordingly.

[0036] In this embodiment, the target synchronization service is run to execute a real-time synchronization mechanism. Executing the real-time synchronization mechanism may include the following steps.

[0037] S31: Monitor the data operation log of the target source table to determine the data change information of the target data row in the target source table.

[0038] S32: Generate a first message body according to the data change information of the target data row, where the first message body includes the data change type, the source table affiliation information of the target data row, the data change content, and the data change time.

[0039] S33: According to the data change time, the first message body is stored in the first data queue of the message cache queue.

[0040] S34: Using the message processor, read the first message body in the first data queue.

[0041] S35: Based on the target mapping rule, the data model of the first message body is converted from the data model of the target source table to the data model of the target aggregation table to obtain a second message body.

[0042] S36: According to the converted data change type included in the second message body, the second message body is stored in a corresponding second data queue, where the second data queue includes at least one of a data addition queue, a data modification queue, and a data deletion queue.

[0043] S37: Execute a data storage operation for the second message body according to a predetermined data storage condition.

[0044] S38: In response to the execution of the data warehousing operation, the target aggregate table is modified according to the instruction information of the second message body to complete the information synchronization between the target source table and the target aggregate table.

[0045] One or more data storage conditions in step S36 can be established according to the actual application scenario.

[0046] In an actual application example, if the data cached in the second data queue reaches the upper capacity limit, the data storage operation can be performed. The upper capacity limit can be determined according to parameter information in the task configuration information, such as the length of the real-time scheduling queue.

[0047] In an actual application example, if the second data queue stores the second message body for the same data row, the data storage operation can be performed. For example, if a data resource is deleted and added at the same time, you can no longer wait and need to perform the data storage operation immediately.

[0048] In an actual application example, if at least one second message body exists in the second data queue at the end of a preset data entry cycle, the data entry operation can be performed. The data entry cycle can be determined by parameter information in the task configuration information, such as real-time scheduling delay. Within a data entry cycle, if the data entry operation has been triggered by other conditions, the data entry cycle can be reset. The data entry cycle ensures the ability to forcibly trigger the data entry operation when it is difficult to form data entry conditions.

[0049] See also Figure 2 ,In an actual application example, running the target synchronization ,service can involve three core components, namely the listener, the message cache queue, and the ,message processor.

[0050] Specifically, the listener may execute the above steps S31 to S33. The data operation log of the target source table monitored by the listener may be a binlog log. The data change type in the first message body may be a change operation such as ADD, UPDATE, or DELETE. The data change content in the first message body may provide detailed data of the target data row.

[0051] The message cache queue can be composed of two parts: a first data queue and an information cache area. Among them, the first data queue can be an ordered queue. The first message body read by the listener can be sorted according to the data change time of the first message body and placed in the first data queue in order to wait for processing. The first data queue can be further divided into a standard cache area and a special cache area. The total length of the first data queue can be determined by the information cache queue length in the task configuration information when creating the target aggregation task. When the first message body enters the first data queue, it generally enters the standard cache area. In certain event scenarios, the data in the standard cache area will enter the special cache area. The message cache area can save some special information waiting to be used.

[0052] The message processor can execute the above steps S34 to S38. After the first message body enters the message processor, the message processor will convert the data model of the first message body into the data model of the target aggregate table according to the target mapping rule to form a second message body. At this time, the second message body will not be directly put into the warehouse, but will be temporarily placed in the second data queue inside the message processor. There can be three second data queues inside the message processor, which are used to store ADD, UPDATE, and DELETE type information respectively. While waiting for the conditions for data entry to be met, the message processor will batch enter the second message bodies in the second data queue into the warehouse. In this way, the data definition language (DDL) operations for the target aggregate table can be reduced, reducing the pressure on the target database.

[0053] In this embodiment, the real-time synchronization mechanism may cause data inconsistency in some abnormal scenarios. In addition, during the initialization phase of the target aggregation task, it may be necessary to synchronize the existing data. Therefore, when running the target synchronization service, the full synchronization mechanism can also be executed.

[0054] See also Figure 3 In some implementations, the full synchronization mechanism is called to traverse at least one target source table. When accessing the current target source table (e.g., table a), the data content of the current target source table and the target aggregate table can be compared to determine the variable data. If the variable data is not empty, the variable data can be synchronized in the target aggregate table, and after synchronizing the variable data, the access can be jumped to the next target source table. If the variable data is empty, it can directly jump to access the next target source table. Until all target source tables have been visited, the traversal can be ended.

[0055] In some embodiments, the real-time synchronization mechanism and the full synchronization mechanism can be executed by the real-time scheduler and the full scheduler, respectively. The full scheduler can loop through the source tables in units of source tables to perform data comparison. Before starting the comparison, the full scheduler can send a full synchronization start event to the real-time scheduler. After completing the data comparison and keeping the data of the source table and the aggregation table consistent, the full scheduler can send a full synchronization completion event to the real-time scheduler.

[0056] In some embodiments, the target synchronization service is run, and a full synchronization event can be executed for the first source table in the target source table. First, the startup information of the full synchronization event can be stored in the message cache area of ​​the message cache queue. Subsequently, the data warehousing operation is performed once, and the second message body currently cached in the second data queue can be cleared. According to the source table attribution information, the third message body matching the first source table can be determined in the first message body currently cached in the first data queue, and the third message body can be transferred from the standard cache area in the first data queue to the special cache area in the first data queue. For the fourth message body that matches the first source table that subsequently enters the first data queue, it can be directly stored in the special cache area. Finally, the third message body and the fourth message body saved in the special cache area can be read and processed, thereby completing a full information synchronization between the first source table and the target aggregate table.

[0057] In some embodiments, after completing a full information synchronization between the first source table and the target aggregate table, the start information of the full synchronization event can be replaced with the completion information of the full synchronization event in the message buffer area. For the remaining message bodies in the special buffer area, they can be transferred to the standard buffer area. After the full synchronization event is completed, the fifth message body that matches the first source table and enters the first data queue will logically enter the standard buffer area normally.

[0058] See also Figure 4 In an actual application example, a full synchronization event can be divided into two stages: start and finish. The full synchronization event can be executed by the full synchronizer. When the full synchronization event of a table (such as table X) is started, the start message of the event will be received by the message cache queue and stored in the information cache area.

[0059] When the message cache queue receives a full synchronization start event, it executes the following logic in sequence:

[0060] 1. Notify the message processor and immediately trigger data storage.

[0061] 2. Wait for the full synchronization signal of the X table, read the message body belonging to the X table in the standard buffer area of ​​the first data queue, and put it into the special buffer area of ​​the first data queue. If the special buffer area is full, discard the earliest data.

[0062] 3. The message body from the X table that subsequently enters the first data queue directly enters the special buffer area.

[0063] After the full synchronization of the data in table X is completed, the message cache queue will receive a full synchronization completion event, and the start event information in the message cache area can be replaced with the completion event information, and then the following logic is executed:

[0064] 1. Read the special buffer area, put the message body whose data change time is after the completion event time into the standard buffer area, and discard the rest of the data.

[0065] 2. Since the full synchronization event of table X has been completed, the message body from table X that enters later will logically enter the standard buffer area normally.

[0066] In particular, during a full synchronization event, the aggregate data corresponding to the X table will stop processing in the real-time synchronizer and will be processed by the full synchronizer to ensure data processing stability. The logic control of the special buffer area can ensure that the newly added message body will not be missed after the full synchronization event is completed.

[0067] In a practical application example, if the processing speed of the message processor is slower than the production speed of the listener, the standard buffer queue may be full, and the message buffer queue may trigger an overflow event. If an overflow event is triggered, the overflow event can be recorded in the message buffer, and a special full synchronization request can be initiated to the full scheduler, so that the target synchronization service immediately executes the full synchronization mechanism.

[0068] It should be noted that there will only be one overflow event at a time, and subsequent overflow data will be directly discarded. When the full synchronization mechanism triggered by the overflow event ends, the overflow event ends. The overflow event mechanism can prevent the loss of synchronization information caused by the inability of the message processor to keep up with the data speed when a large number of data changes occur instantly in some source tables.

[0069] See also Figure 5, a database table aggregation method provided in an embodiment of the present disclosure can be encapsulated into an automated aggregation program. The automated aggregation program focuses on the data aggregation operation of the database, and requires the user to define the aggregation table and the mapping relationship between the source database table and the aggregation table. After the automated aggregation program is started, real-time synchronization and scheduled full synchronization tasks can be started according to the template information set by the user. Real-time synchronization is responsible for synchronizing the DML information in the original data table to the aggregation table in real time, while full synchronization regularly compares the original data table and the aggregation table data to ensure data consistency. The highlight of the automated aggregation program is that it provides configuration capabilities, which can uniformly manage multiple tasks and freely maintain each task. Users can freely change the task logic and pause and start tasks through the program interface according to their business changes and actual needs, which saves a lot of coding time and maintenance costs for the aggregation operations of multiple data tables.

[0070] Specifically, the main structure of the automated aggregation program may include a configuration center, a resource controller, a task manager, a task scheduling center, a northbound service gateway, and other parts.

[0071] The configuration center is used to store the relevant configuration information of the automated aggregation program, such as task information, task scheduling information, data source information, etc. The resource controller is used to connect to the configuration center and is responsible for the persistence and query of program information. The task manager is responsible for the creation and maintenance of aggregation tasks. The task scheduling center is responsible for the control of the aggregation task synchronization service. It has a real-time synchronization task scheduler and a full synchronization task scheduler, which are responsible for the real-time synchronization and full synchronization scheduling of the synchronization service respectively. The northbound service gateway is used to provide northbound interface capabilities for upper-layer applications to perform synchronization logic configuration.

[0072] After the automatic aggregation program is started, it will initialize two basic services, namely the management service and the synchronization service. Among them, the management service is the related work of the task manager. Users can use this service to create, edit, start, pause, delete and other operations of aggregation tasks. This service is responsible for maintaining the aggregation task itself, and the specific data synchronization is the responsibility of the corresponding synchronization service. Based on the management service, the automatic aggregation program allows multiple aggregation tasks to run at the same time. The synchronization service of each aggregation task is independent and does not affect each other. According to the aggregation task configured by the user, the task scheduler center will start the synchronization service of the task. A synchronization service is divided into a real-time synchronization service and a full synchronization service. The real-time synchronization service is responsible for the data synchronization of real-time changes in the database table, and the full synchronization service is responsible for periodic data comparison and data completion in abnormal scenarios. The two synchronization services work together to ensure the stability and availability of aggregation tasks in various scenarios.

[0073] See also Figure 6In an actual application example, after the automated aggregation program is started, users can access the program through the northbound service gateway to create tasks. According to the guidance, users can select parameters such as data source, aggregation table, full scheduling cycle, real-time synchronization queue configuration, etc. to determine the basic information of the task. On this basis, they can select the aggregation source table and the mapping relationship between the source table and the aggregation table. Among them, the data source represents the database connection address. The aggregation table represents the selected aggregation table. The cache queue length represents how much data can be retained in the cache area at most. The full scheduling cycle represents the interval period of full synchronization. The real-time scheduling delay represents how often the data entry operation is triggered. The real-time scheduling queue length represents how much data is allowed to be cached in the queue in the scheduler. The aggregation source table represents the source table selected to participate in the aggregation. The aggregation table mapping represents the field mapping rules for the source table and the aggregation table, which can support simple mapping or complex processing of script logic.

[0074] After the above information is set, the automatic aggregation program will persist to the configuration center through the resource controller, and notify the task scheduling center to initialize the synchronization service of the task. At this point, an aggregation task is created and initialized, and the subsequent source table data will be synchronized to the aggregation table by the synchronization service according to the configured mapping model.

[0075] The automated aggregation program allows modification of the source table, table mapping, full scheduling cycle and other information of the task. The overall process of task modification is basically the same as that of task creation. The difference is that when the modification request reaches the task manager, the task manager will notify the task manager at this time, triggering the change logic of the synchronization task. Consistent with the modification operation, when the task triggers deletion, suspension, and start, the corresponding information will be synchronized to the task manager, and the manager will control the status of the synchronization service and modify the persistent information of the task in the configuration center.

[0076] Through the above mechanism, users can quickly maintain the status of aggregation tasks according to actual conditions without manual coding, saving a lot of code writing work in business scenarios such as global search and log aggregation.

[0077] See also Figure 7 In an actual application example, the synchronization service can refer to the synchronization program started by the task manager that contains all aggregate tasks. In this synchronization program, each aggregate task will have a corresponding synchronization service, which are independent of each other and do not affect each other. Each synchronization service is divided into a real-time synchronizer and a full synchronizer.

[0078] As can be seen from the above, the technical solution provided by one or more embodiments of the present disclosure allows users to create aggregation tasks in a configured manner, which can reduce the difficulty of creating aggregation tasks. According to multiple mapping rules, different aggregation tasks can be created separately to complete the data synchronization function from the source data table to the aggregation table. Mutually independent aggregation tasks can reduce the difficulty of maintaining the aggregation service.

[0079] The technical solution provided by one or more embodiments of the present disclosure can run a corresponding target synchronization service when it comes to target aggregation tasks. The target synchronization service can include two synchronization mechanisms: real-time synchronization and full synchronization. The mutual cooperation of the two synchronization mechanisms enables the target synchronization service to meet a variety of actual work scenarios and improve the efficiency and stability of the aggregation tasks.

[0080] See also Figure 8 The present application also provides a database table aggregation device, the device comprising:

[0081] An acquisition unit 100 is used to acquire task configuration information, where the task configuration information includes a plurality of mapping rules;

[0082] A management unit 200 is used to determine a target aggregation task according to a target mapping rule among the plurality of mapping rules, wherein the target aggregation task represents aggregating data of at least one target source table into a target aggregation table;

[0083] The synchronization unit 300 is used to run a target synchronization service for the target aggregation task. The target synchronization service includes a first synchronization mechanism and a second synchronization mechanism. The first synchronization mechanism is used to synchronize the data change information of the target source table to the target aggregation table in real time. The second synchronization mechanism is used to synchronize the data information of the target source table in full to the target aggregation table when a preset condition is met.

[0084] In one embodiment, the management unit 200 is further used to obtain a control instruction; and manage the target aggregation task according to the control instruction, wherein the management includes at least one of creation, editing, start, pause, and deletion operations.

[0085] In one embodiment, the synchronization unit 300 is specifically used to monitor the data operation log of the target source table to determine the data change information of the target data row in the target source table; generate a first message body according to the data change information of the target data row, the first message body including the data change type, the source table affiliation information of the target data row, the data change content, and the data change time; store the first message body in the first data queue of the message cache queue according to the data change time; use the message processor to read the first message body in the first data queue; based on the target mapping rule, convert the data model of the first message body from the data model of the target source table to the data model of the target aggregate table to obtain a second message body; according to the converted data change type included in the second message body, store the second message body in the corresponding second data queue, the second data queue including at least one of a data addition queue, a data modification queue, and a data deletion queue; according to a predetermined data entry condition, perform a data entry operation for the second message body; in response to the execution of the data entry operation, modify the target aggregate table according to the indication information of the second message body to complete the information synchronization between the target source table and the target aggregate table.

[0086] In one embodiment, the synchronization unit 300 is specifically used to execute the data entry operation if the data cached in the second data queue reaches the capacity upper limit, and the capacity upper limit is determined according to the real-time scheduling queue length in the task configuration information; if the second data queue stores a second message body for the same data row, the data entry operation is executed; if at the end of a preset data entry cycle, there is at least one second message body in the second data queue, the data entry operation is executed, and the data entry cycle is determined by the real-time scheduling delay in the task configuration information.

[0087] In one embodiment, the synchronization unit 300 is also used to execute a full synchronization event for the first source table in the target source table; store the startup information of the full synchronization event into the message cache area of ​​the message cache queue; execute the data warehousing operation once to clear the second message body currently cached in the second data queue; determine the third message body matching the first source table in the first message body currently cached in the first data queue according to the source table attribution information; transfer the third message body from the standard cache area in the first data queue to the special cache area in the first data queue; store the fourth message body matching the first source table that subsequently enters the first data queue into the special cache area; read and process the third message body and the fourth message body saved in the special cache area to complete a full information synchronization between the first source table and the target aggregation table.

[0088] In one embodiment, after completing a full information synchronization between the first source table and the target aggregate table, the synchronization unit 300 is also used to replace the start information of the full synchronization event with the completion information of the full synchronization event in the message cache area; transfer the remaining message body in the special cache area to the standard cache area; and store the fifth message body that subsequently enters the first data queue and matches the first source table into the standard cache area.

[0089] In one embodiment, the synchronization unit 300 is also used to call the full synchronization mechanism and traverse the at least one target source table; when accessing the current target source table, compare the data content of the current target source table with the target aggregate table to determine the variable data; if the variable data is not empty, synchronize the variable data in the target aggregate table, and after synchronizing the variable data, jump to access the next target source table; if the variable data is empty, jump to access the next target source table; until all target source tables in the at least one target source table have been visited, the traversal is terminated.

[0090] Each unit described in the above embodiments may be implemented by a computer chip or a product having a certain function. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.

[0091] For the convenience of description, the above devices are described in terms of functions and are described separately in various units. Of course, when implementing the present application, the functions of each unit can be implemented in the same or multiple software and / or hardware.

[0092] See also Fig. 9 The present application also provides an electronic device, which includes a memory and a processor, wherein the memory is used to store a computer program, and when the computer program is executed by the processor, the above-mentioned database table aggregation method is implemented.

[0093] The present application also provides a computer-readable storage medium, which is used to store a computer program. When the computer program is executed by a processor, the above-mentioned database table aggregation method is implemented.

[0094] The processor may be a central processing unit (CPU). The processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or a combination of the above chips.

[0095] As a non-transitory computer-readable storage medium, the memory can be used to store non-transitory software programs, non-transitory computer executable programs and modules, such as program instructions / modules corresponding to the method in the embodiment of the present disclosure. The processor executes various functional applications and data processing of the processor by running the non-transitory software programs, instructions and modules stored in the memory, that is, implementing the method in the above method embodiment.

[0096] The memory may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created by the processor, etc. In addition, the memory may include a high-speed random access memory, and may also include a non-transitory memory, such as at least one disk storage device, a flash memory device, or other non-transitory solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0097] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the storage medium can be a disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD), etc.; the storage medium can also include a combination of the above-mentioned types of memory.

[0098] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the embodiments of the device, electronic device, and storage medium, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.

[0099] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

[0100] Although the embodiments of the present disclosure have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present disclosure, and such modifications and variations are all within the scope defined by the appended claims.

Claims

1. A database table aggregation method, characterized in that: The method comprises: Acquire task configuration information, where the task configuration information includes a plurality of mapping rules; Determine a target aggregation task according to a target mapping rule among the plurality of mapping rules, wherein the target aggregation task represents aggregating data of at least one target source table into a target aggregation table; For the target aggregation task, a target synchronization service is run, and the target synchronization service includes a first synchronization mechanism and a second synchronization mechanism. The first synchronization mechanism is used to synchronize the data change information of the target source table to the target aggregation table in real time, and the second synchronization mechanism is used to synchronize the data information of the target source table in full to the target aggregation table when preset conditions are met.

2. The method according to claim 1, characterized in that The method further comprises: Get control instructions; According to the control instruction, the target aggregation task is managed, and the management includes at least one of creation, editing, start, pause, and deletion operations.

3. The method according to claim 1, characterized in that The running target synchronization service includes: Monitor the data operation log of the target source table to determine data change information of the target data row in the target source table; Generate a first message body according to the data change information of the target data row, wherein the first message body includes the data change type, the source table ownership information of the target data row, the data change content, and the data change time; According to the data change time, storing the first message body into a first data queue of a message cache queue; Using a message processor, reading the first message body in the first data queue; Based on the target mapping rule, converting the data model of the first message body from the data model of the target source table to the data model of the target aggregation table to obtain a second message body; According to the converted data change type included in the second message body, storing the second message body in a corresponding second data queue, wherein the second data queue includes at least one of a data addition queue, a data modification queue, and a data deletion queue; According to a predetermined data storage condition, executing a data storage operation for the second message body; In response to the execution of the data warehousing operation, the target aggregate table is modified according to the instruction information of the second message body to complete the information synchronization between the target source table and the target aggregate table.

4. The method according to claim 3, characterized in that The performing of the data storage operation matching the second message body according to the predetermined data storage condition includes at least one of the following: If the data cached in the second data queue reaches the upper capacity limit, the data storage operation is performed, and the upper capacity limit is determined according to the real-time scheduling queue length in the task configuration information; If the second data queue stores a second message body for the same data row, the data storage operation is performed; If at the end of a preset data storage cycle, there is at least one second message body in the second data queue, the data storage operation is performed, and the data storage cycle is determined by the real-time scheduling delay in the task configuration information.

5. The method according to claim 3, characterized in that: The running target synchronization service further includes: For the first source table in the target source table, execute a full synchronization event; Storing the start information of the full synchronization event into the message buffer area of ​​the message buffer queue; Execute the data storage operation once, and clear the second message body currently cached in the second data queue; According to the source table attribution information, determining a third message body matching the first source table in the first message body currently cached by the first data queue; Transferring the third message body from the standard buffer area in the first data queue to the special buffer area in the first data queue; storing a fourth message body that subsequently enters the first data queue and matches the first source table into the special buffer area; The third message body and the fourth message body stored in the special buffer area are read and processed to complete a full information synchronization between the first source table and the target aggregate table.

6. The method according to claim 5, characterized in that After completing a full information synchronization between the first source table and the target aggregate table, the method further includes: In the message buffer area, replacing the start information of the full synchronization event with the completion information of the full synchronization event; Transferring the remaining message body in the special buffer area to the standard buffer area; The fifth message body that subsequently enters the first data queue and matches the first source table is stored in the standard buffer area.

7. The method according to any one of claims 1 to 6, characterized in that: The running target synchronization service includes: Invoke the full synchronization mechanism to traverse the at least one target source table; When accessing the current target source table, comparing the data content of the current target source table with the data content of the target aggregation table to determine the variable data; If the variable data is not empty, the variable data is synchronized in the target aggregate table, and after synchronizing the variable data, the access is jumped to the next target source table; If the variable data is empty, jump to access the next target source table; The traversal is terminated until all target source tables in the at least one target source table have been visited.

8. A database table aggregation device, characterized in that: The device comprises: An acquisition unit, configured to acquire task configuration information, wherein the task configuration information includes a plurality of mapping rules; A management unit, configured to determine a target aggregation task according to a target mapping rule among the plurality of mapping rules, wherein the target aggregation task represents aggregating data of at least one target source table into a target aggregation table; A synchronization unit is used to run a target synchronization service for the target aggregation task, and the target synchronization service includes a first synchronization mechanism and a second synchronization mechanism. The first synchronization mechanism is used to synchronize the data change information of the target source table to the target aggregation table in real time, and the second synchronization mechanism is used to synchronize the data information of the target source table to the target aggregation table in full when a preset condition is met.

9. An electronic device, characterized in that: The electronic device comprises a memory and a processor, wherein the memory is used to store a computer program, and when the computer program is executed by the processor, the method according to any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.

Citation Information

Cited By

  • Transportation hub energy management and control system data storage method and system

    CN121350052A