Asynchronous Task-based Timing Metadata Cache Synchronization Device and Method

Through the timing metadata cache synchronization device based on asynchronous tasks, the timing database metadata cache consistency problem is solved, and fast response and accurate query services are realized.

CN115599833BActive Publication Date: 2025-07-04上海沄熹科技有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211077444.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-05
Publication Date
2025-07-04
Estimated Expiration
2042-09-05

AI Technical Summary

Technical Problem

In the prior art, the consistency cannot be guaranteed when the time series database metadata cache changes, resulting in slow query response speed and inability to synchronize in time.

Method used

The timing metadata cache synchronization device based on asynchronous tasks is adopted, including a metadata update module, an asynchronous task creation module, an asynchronous task scheduling execution module and a metadata cache update module. By creating a job and scheduling execution in the database background, the synchronization and consistency of the metadata cache is achieved.

Benefits of technology

The consistency between the time sequence object metadata cache and the actual metadata is realized, and the query response speed and accuracy are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115599833B_ABST
    Figure CN115599833B_ABST
Patent Text Reader

Abstract

The present invention discloses a timing metadata cache synchronization device and method based on asynchronous tasks, belonging to the technical field of database operations. The technical problem to be solved is how to enable the database to support the cache of timing database object metadata and ensure that the timing metadata cache can be synchronized in a timely manner. It includes: a metadata update module for performing change operations on the metadata of a specified timing object; an asynchronous task creation module for creating a Job, storing the object information and metadata updated for the specified timing object in the Job, and invalidating the metadata cache of the specified timing object; an asynchronous task scheduling and execution module for triggering the database background to obtain the Jobs being executed or not executed and scheduling the executable Jobs to execute according to the type; and a metadata cache update module for obtaining and executing the Jobs for metadata caching, and sending the object information and metadata updated for the specified timing object stored in the Jobs to the end where the metadata cache is located.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of database operations, and more specifically to a timing metadata cache synchronization device and method based on asynchronous tasks. Background Art

[0002] A time series database is also known as a temporal database. A time series database mainly processes data with time tags (changing in the order of time, i.e., time serialization), and data with time tags is also called time series data.

[0003] Time series data is mainly collected and generated by various types of real-time monitoring, inspection, and analysis equipment in the power industry, chemical industry, meteorological industry, geographic information, etc. The typical characteristics of these industrial data are: high generation frequency (multiple data can be generated at each monitoring point within one second), strong dependence on the collection time (each piece of data requires a unique corresponding time), and a large number of measuring points with a large amount of information.

[0004] For the storage and processing of time series big data, the relational database method is often used for processing. However, due to the inherent disadvantages of the relational database, it cannot perform efficient storage and data query. The time series big data solution enables time series big data to be efficiently stored and quickly processed through the use of a special storage method, which is an important technology for solving the problem of processing massive data. This technology uses a special data storage method, which greatly improves the processing ability of time-related data. Compared with the relational database, its storage space is halved, and the query speed is greatly improved.

[0005] Since the current time series data platform needs to provide time series data query services at different ends, when querying time series data, it is necessary to access the metadata of time series objects. In order to quickly respond to query requests, it is necessary to store the timing metadata cache at each end. When the metadata of the time series database changes, the metadata change and cache synchronization cannot be completed through an atomic transaction, that is, the consistency of the metadata cache cannot be guaranteed.

[0006] In order to enable the time series data query to respond quickly, how to make the database support the metadata cache of time series database objects and enable the timing metadata cache to be synchronized in a timely manner, so as to respond to query requirements faster and more accurately, is a technical problem to be solved. Summary of the Invention

[0007] The technical task of the present invention is to address the above deficiencies and provide a timing metadata cache synchronization device and method based on asynchronous tasks to solve the technical problem of how to make the database support the metadata cache of time series database objects and enable the timing metadata cache to be synchronized in a timely manner.

[0008] An apparatus for synchronizing time-series metadata caches based on asynchronous tasks, configured in a database, which receives SQL statements for performing change operations on the metadata of time-series objects from an application layer and creates change transactions based on the SQL statements. The apparatus includes:

[0009] A metadata update module. For each change transaction, the metadata update module is used to perform a change operation on the metadata of a specified time-series object based on the SQL statement and commit the change transaction.

[0010] An asynchronous task creation module. For each change transaction, the asynchronous task creation module is used to determine whether there is a metadata cache for the specified time-series object. If so, create a Job for metadata synchronization cache, store the object information and metadata updated for the specified time-series object in the Job, and set the metadata cache of the specified time-series object to invalid.

[0011] An asynchronous task scheduling and execution module, which is used to trigger the database background to obtain the Jobs being executed or not executed and schedule the executable Jobs to execute according to types.

[0012] A metadata cache update module. For a change transaction with successful submission, the metadata cache update module is used to obtain the corresponding executable Job, execute the Job for metadata caching, and send the object information and metadata updated for the specified time-series object stored in the Job to the end where the metadata cache is located.

[0013] Preferably, the metadata update module is used to perform the following:

[0014] Parse the SQL statement, including syntax parsing and semantic parsing.

[0015] Generate a plan based on the parsed SQL statement, including a logical plan and a physical plan.

[0016] Execute the plan to perform a change operation on the metadata of the specified time-series object.

[0017] After verifying that the change operation is valid, write the updated metadata of the time-series object into the system table.

[0018] Commit the change transaction. If the change transaction is rolled back, the updated metadata written into the system table is rolled back. If the change transaction is successfully committed, the updated metadata is successfully written into the system table.

[0019] Preferably, the asynchronous task execution module is used to perform:

[0020] During the execution of the SQL statement, determine whether there is a metadata cache for the specified time-series object.

[0021] If it exists, create a Job of type tsMetaCacheSync, and store the object information and metadata updated for the specified time series object into the Job. The object information includes the subordinate relationship of the time series object, and the updated metadata is read from the system table;

[0022] Replace the metadata cache of the specified time series object with the setting being invalidated;

[0023] If the corresponding change transaction is rolled back, the Job is rolled back. If the corresponding change transaction is committed successfully, the Job is created successfully.

[0024] Preferably, for each change transaction, after storing the object information and metadata updated for the specified time series object into the Job, the asynchronous task execution module is used to add the JobID of the Job to the system table;

[0025] The JobIDs of multiple types of Jobs are stored in the system table and sorted by creation time;

[0026] The asynchronous task scheduling and execution module is used to execute:

[0027] For a change transaction that has been committed successfully, send a signal to the database background through the channel, call the database background to poll the system table, and obtain the newly created and unstarted or executing JobID;

[0028] Load the Job based on the JobID, select the Job corresponding to the change transaction from the loaded Job, and for the selected Job, call the metadata cache update module to execute the Job for metadata caching;

[0029] If an error occurs during the execution of the Job, judge the error type. If it is a non-retryable error, return the error and mark the Job as failed. If it is a retryable error, retry the execution of the Job. If the retry threshold is not reached or the execution is not successful, return the error and mark the Job as failed.

[0030] Preferably, the metadata cache update module is used to execute:

[0031] Obtain the object information and metadata updated for the specified time series object stored in the Job, and send the object information and metadata updated for the specified time series object to the end where the metadata cache is located, wait for the response from the end where the metadata cache is located. If the response is successful, mark the Job status as successful, otherwise mark the Job status as failed.

[0032] Second aspect, a method for caching and synchronizing time-series metadata based on asynchronous tasks according to the present invention is used to implement caching of time-series metadata and metadata cache synchronization through the device for caching and synchronizing time-series metadata based on asynchronous tasks as described in any item of the first aspect. The method includes:

[0033] The database receives an SQL statement for changing the metadata of a time-series object from the application layer and creates a change transaction based on the SQL statement;

[0034] For each change transaction, perform a change operation on the metadata of the specified time-series object based on the SQL statement and commit the change transaction;

[0035] For each change transaction, determine whether there is metadata caching for the specified time-series object. If there is, create a Job for metadata synchronization caching, store the object information and metadata updated for the specified time-series object in the Job, and set the metadata cache of the specified time-series object to invalid;

[0036] Trigger the database background to obtain the Jobs that are being executed or not executed and schedule the executable Jobs to execute according to the type;

[0037] For the change transaction with successful submission, obtain the corresponding executable Job and execute the Job for metadata caching, and send the object information and metadata updated for the specified time-series object stored in the Job to the end where the metadata cache is located.

[0038] Preferably, for each change transaction, performing a change operation on the metadata of the specified time-series object based on the SQL statement includes the following:

[0039] Parse the SQL statement, including syntax parsing and semantic parsing;

[0040] Generate a plan based on the parsed SQL statement, including a logical plan and a physical plan;

[0041] Execute the plan to perform a change operation on the metadata of the specified time-series object;

[0042] After verifying that the change operation is valid, write the updated metadata of the time-series object into the system table;

[0043] Commit the change transaction. If the change transaction rolls back, the updated metadata written into the system table rolls back. If the change transaction is successfully committed, the updated metadata is successfully written into the system table.

[0044] Preferably, for each change transaction, during the execution of the SQL statement, determine whether there is metadata caching for the specified time-series object;

[0045] If it exists, create a Job of type tsMetaCacheSync, store the object information and metadata updated by the specified time series object into the Job, where the object information includes the dependency relationship of the time series object, and the updated metadata is read from the system table; invalidate the metadata cache of the specified time series object and set it to invalid;

[0046] If the corresponding change transaction is rolled back, the Job is rolled back; if the corresponding change transaction is committed successfully, the Job is created successfully.

[0047] Preferably, for each change transaction, after storing the object information and metadata updated by the specified time series object into the Job, add the JobID of the Job to the system table;

[0048] The JobIDs of multiple types of Jobs are stored in the system table and sorted by creation time;

[0049] For a successfully committed change transaction, send a signal to the database background through a channel, call the database background to poll the system table, and obtain the newly created JobID that has not started or is in progress;

[0050] Load the Job based on the JobID, select the Job corresponding to the change transaction from the loaded Job, and for the selected Job, execute the Job for metadata caching;

[0051] If an error occurs during the execution of the Job, determine the error type. If it is a non-retryable error, return the error and mark the Job as failed; if it is a retryable error, retry the execution of the Job. If the retry threshold is not reached or the execution is not successful, return the error and mark the Job as failed.

[0052] Preferably, obtain the object information and metadata updated by the specified time series object stored in the Job, send the object information and metadata updated by the specified time series object to the end where the metadata cache is located, and then wait for the response from the end where the metadata cache is located. If the response is successful, mark the status of the Job as successful; otherwise, mark the status of the Job as failed.

[0053] The asynchronous task-based timing metadata cache synchronization device and method of the present invention have the following advantages: When performing a metadata change operation, if there is a metadata cache for a timing object, the metadata cache is set to invalid, and the Jobs that are being executed or not executed are obtained through the database background, and the executable Jobs are scheduled to be executed according to their types. Executing the executable Jobs sends the object information and metadata updated for the specified timing object stored in the Jobs to the end where the metadata cache is located, thereby realizing the timing object metadata cache and metadata cache synchronization, making the timing object metadata cache providing query services consistent with the actual metadata of the object, that is, ensuring the consistency of the timing object metadata. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following will briefly introduce the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.

[0055] The present invention will be further described below in conjunction with the drawings.

[0056] Figure 1 It is a flowchart of the working process of the metadata update module in the timing metadata cache synchronization device based on asynchronous tasks in Embodiment 1;

[0057] Figure 2 It is a flowchart of the working process of the asynchronous task creation module in the timing metadata cache synchronization device based on asynchronous tasks in Embodiment 1;

[0058] Figure 3 It is a flowchart of the working process of the asynchronous task scheduling and execution module in the timing metadata cache synchronization device based on asynchronous tasks in Embodiment 1. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0059] The present invention will be further described below in conjunction with the drawings and specific embodiments, so that those skilled in the art can better understand the present invention and be able to implement it. However, the specific embodiments cited do not limit the present invention. Without conflict, the embodiments of the present invention and the technical features in the embodiments can be combined with each other.

[0060] The embodiments of the present invention provide an asynchronous task-based timing metadata cache synchronization device and method, which are used to solve the technical problem of how to enable the database to support the timing database object metadata cache and enable the timing metadata cache to be synchronized in a timely manner.

[0061] Embodiment 1:

[0062] An asynchronous task-based timing metadata cache synchronization device of the present invention includes a metadata update module, an asynchronous task creation module, an asynchronous task creation module, an asynchronous task scheduling and execution module, and a metadata cache update module. The device is configured in a database, and the database receives SQL statements for changing the metadata of timing objects from an application layer and creates a change transaction based on the SQL statements.

[0063] For each change transaction, the metadata update module is used to change the metadata of the specified timing object based on the SQL statement and submit the change transaction.

[0064] As a specific implementation, as Figure 1 shown, the metadata update module is used to perform the following:

[0065] (1) Parse the SQL statement, including syntax parsing and semantic parsing;

[0066] (2) Generate a plan based on the parsed SQL statement, including a logical plan and a physical plan;

[0067] (3) Execute the plan to change the metadata of the specified timing object;

[0068] (4) After verifying that the change operation is valid, write the updated metadata of the timing object to the system table;

[0069] (5) Submit the change transaction. If the change transaction is rolled back, the updated metadata written to the system table is rolled back. If the change transaction is successfully committed, the updated metadata is successfully written to the system table.

[0070] The asynchronous task creation module is used to determine whether there is a metadata buffer for the specified timing object. If so, create a Job for metadata synchronization cache, store the updated object information and metadata of the specified timing object in the Job, and set the metadata cache of the specified timing object to invalid.

[0071] As a specific implementation, as Figure 2 shown, the asynchronous task creation module is used to execute:

[0072] (1) During the execution of the SQL statement, determine whether there is a metadata cache for the specified timing object;

[0073] (2) If so, create a Job of the tsMetaCacheSync type, store the updated object information and metadata of the specified timing object in the Job. The object information includes the subordinate relationship of the timing object, and the updated metadata is read from the system table;

[0074] (3) Change the metadata cache of the specified timing object to be set as invalid;

[0075] (4) If the corresponding change transaction is rolled back, the Job is rolled back; if the corresponding change transaction is committed successfully, the Job is created successfully.

[0076] For each change transaction, after the object information and metadata of the specified time series object update are stored in the Job, the asynchronous task execution module is used to add the JobID of the Job to the system table; the JobIDs of multiple types of jobs are stored in the system table and sorted by creation time.

[0077] In this embodiment, for each change transaction, after the object information and metadata of the specified time series object update are stored in the Job, the asynchronous task execution module is used to add the JobID of the Job to the system table. The JobIDs of multiple types of jobs are stored in the system table and sorted by creation time.

[0078] As a specific implementation, the asynchronous task execution module is used to execute:

[0079] (1) During the SQL statement execution process, determine whether there is a metadata cache for the specified time series object;

[0080] (2) If it exists, create a tsMetaCacheSync type job, store the object information and metadata of the specified time series object update to the job, the object information includes the subordinate relationship of the time series object, and the updated metadata is read from the system table;

[0081] (3) Change the metadata cache of the specified time series object to invalid;

[0082] (4) If the corresponding change transaction is rolled back, the Job is rolled back; if the corresponding change transaction is committed successfully, the Job is created successfully.

[0083] The asynchronous task scheduling and execution module is used to trigger the database background to obtain the jobs that are being executed or not executed and schedule the executable jobs to be executed according to the type.

[0084] As a specific implementation, Figure 3 The asynchronous task scheduling execution module is used to execute:

[0085] (1) For a successfully submitted change transaction, a signal is sent to the database backend through the channel, which calls the database backend to poll the system table to obtain the newly created JobID that has not yet started or is being executed;

[0086] (2) Load the Job based on the JobID, select the Job corresponding to the change transaction from the loaded Job, and for the selected Job, call the metadata cache update module to execute the Job for metadata caching;

[0087] (3) If an error occurs during Job execution, determine the error type. If it is a non-retryable error, return the error and mark the Job as failed. If it is a retryable error, retry the Job execution. If the retry threshold is not reached or the execution is not successful, return the error and mark the Job as failed.

[0088] For a successfully submitted change transaction, the metadata cache update module is used to obtain the corresponding executable Job, execute the Job for metadata caching, and send the object information and metadata updated by the specified time-series object stored in the Job to the end where the metadata cache is located.

[0089] As a specific implementation, the metadata cache update module is used to execute: obtain the object information and metadata updated by the specified time-series object stored in the Job, and send the object information and metadata updated by the specified time-series object to the end where the metadata cache is located, wait for the response from the end where the metadata cache is located. If the response is successful, mark the Job status as successful, otherwise mark the Job status as failed.

[0090] The time-series metadata cache synchronization device based on asynchronous tasks in this embodiment supports metadata caching of time-series objects and metadata cache synchronization. The specific operations are as follows:

[0091] Operation 1: The user executes an operation to change time-series metadata, converts the operation into an SQL statement, and the database parses and executes it;

[0092] Operation 2: Invalidate the metadata cache of the changed object, create a Job to store the information of the changed object, and roll back or execute according to the commit status of the transaction;

[0093] Operation 3: After the transaction is successfully committed, schedule the executable Job to execute normally, and obtain the latest metadata structure according to the stored information of the changed object;

[0094] Operation 4: Send the obtained new metadata structure to the cache synchronization end, wait for the response, and mark the Job as successful or failed according to the returned error information.

[0095] Embodiment 2:

[0096] A time-series metadata cache synchronization method based on asynchronous tasks of the present invention realizes the caching of time-series metadata and metadata cache synchronization through the device disclosed in Embodiment 1. The method includes the following steps:

[0097] S100. The database receives SQL statements for changing the metadata of time-series objects from the application layer and creates a change transaction based on the SQL statements.

[0098] When a user wants to change the structure of a time-series object, some operations for changing the metadata are required. In the database, it is the converted Data Definition Language (DDL). The SQL statements are executed to complete the change of the metadata structure of the time-series object.

[0099] S200. For each change transaction, perform a change operation on the metadata of the specified time-series object based on the SQL statement and commit the change transaction.

[0100] As a specific implementation of step S200, this step includes the following operations:

[0101] (1) Parse the SQL statement, including syntax parsing and semantic parsing;

[0102] (2) Generate a plan based on the parsed SQL statement, including a logical plan and a physical plan;

[0103] (3) Execute the plan to perform a change operation on the metadata of the specified time-series object;

[0104] (4) After verifying that the change operation is valid, write the updated metadata of the time-series object into the system table;

[0105] (5) Commit the change transaction. If the change transaction is rolled back, the updated metadata written into the system table is rolled back. If the change transaction is committed successfully, the updated metadata is successfully written into the system table.

[0106] S300. For each change transaction, determine whether there is a metadata buffer for the specified time-series object. If so, create a Job for metadata synchronization caching, store the updated object information and metadata of the specified time-series object in the Job, and set the metadata cache of the specified time-series object to invalid.

[0107] As a specific implementation of step S300, for each change transaction, during the execution of the SQL statement, determine whether there is a metadata cache for the specified time-series object; if so, create a Job of type tsMetaCacheSync, store the updated object information and metadata of the specified time-series object in the Job, where the object information includes the subordinate relationship of the time-series object, and the updated metadata is read from the system table; set the metadata cache of the specified time-series object to invalid; if the corresponding change transaction is rolled back, the Job is rolled back, and if the corresponding change transaction is committed successfully, the Job is successfully created.

[0108] For each change transaction, after storing the object information and metadata updated by the specified timing object in the Job, this step adds the JobID of the Job to the system table; the JobIDs of multiple types of Jobs are stored in the system table and sorted by creation time.

[0109] S400. Trigger the database background to obtain the Jobs that are being executed or not executed, and schedule the executable Jobs to be executed according to their types.

[0110] As a specific implementation of step S400, for a successfully submitted change transaction, a signal is sent to the database background through the channel, and the database background is called to poll the system table to obtain the newly created JobIDs that have not started or are being executed; the Jobs are loaded based on the JobIDs, and the Jobs corresponding to the change transaction are selected from the loaded Jobs. For the selected Jobs, the Jobs are executed for metadata caching; if an error occurs during the execution of the Job, the error type is judged. If it is a non-retryable error, an error is returned and the Job is marked as failed. If it is a retryable error, the execution of the Job is retried. If the retry threshold is not reached or the execution is not successful, an error is returned and the Job is marked as failed.

[0111] S500. For a successfully submitted change transaction, obtain the corresponding executable Job, execute the Job for metadata caching, and send the object information and metadata updated by the specified timing object stored in the Job to the end where the metadata cache is located.

[0112] After obtaining the object information and metadata updated by the specified timing object stored in the Job in step S500 and sending the object information and metadata updated by the specified timing object to the end where the metadata cache is located, wait for the response from the end where the metadata cache is located. If the response is successful, mark the status of the Job as successful; otherwise, mark the status of the Job as failed.

[0113] The present invention has been shown and described in detail above through the drawings and preferred embodiments. However, the present invention is not limited to these disclosed embodiments. Based on the above-mentioned multiple embodiments, those skilled in the art can know that more embodiments of the present invention can be obtained by combining the means in the above different embodiments, and these embodiments are also within the protection scope of the present invention.

Claims

1. A timing metadata cache synchronization device based on asynchronous tasks, characterized in that Configured in a database, the database receives SQL statements for changing the metadata of time-series objects from an application layer and creates a change transaction based on the SQL statements. The apparatus includes: A metadata update module. For each change transaction, the metadata update module is used to change the metadata of a specified time-series object based on the SQL statement and commit the change transaction; An asynchronous task creation module. For each change transaction, the asynchronous task creation module is used to determine whether there is a metadata cache for the specified time-series object. If so, create a Job for metadata synchronization cache, store the object information and metadata updated for the specified time-series object into the Job, and invalidate the metadata cache of the specified time-series object; An asynchronous task scheduling and execution module. The asynchronous task scheduling and execution module is used to trigger the database background to obtain Jobs that are being executed or not executed and schedule executable Jobs to execute according to types; A metadata cache update module. For a change transaction with successful submission, the metadata cache update module is used to obtain the corresponding executable Job, execute the Job for metadata caching, and send the object information and metadata updated for the specified time-series object stored in the Job to the end where the metadata cache is located.

2. The asynchronous task-based timing metadata cache synchronization device according to claim 1, wherein The metadata update module is used to perform the following: Parse the SQL statement, including syntax parsing and semantic parsing; Generate a plan based on the parsed SQL statement, including a logical plan and a physical plan; Execute the plan to change the metadata of the specified time-series object; After verifying that the change operation is valid, write the updated metadata of the time-series object into the system table; Commit the change transaction. If the change transaction is rolled back, the updated metadata written into the system table is rolled back. If the change transaction is successfully committed, the updated metadata is successfully written into the system table.

3. The asynchronous task-based timing metadata cache synchronization device according to claim 1, wherein The asynchronous task execution module is used to perform: During the execution of the SQL statement, determine whether there is a metadata cache for the specified time-series object; If so, create a Job of type tsMetaCacheSync, store the object information and metadata updated for the specified time-series object into the Job. The object information includes the subordinate relationship of the time-series object, and the updated metadata is read from the system table; Invalidate the metadata cache of the specified time-series object; If the corresponding change transaction is rolled back, the Job is rolled back. If the corresponding change transaction is successfully committed, the Job is successfully created.

4. The asynchronous task-based timing metadata cache synchronization device according to claim 1, wherein For each change transaction, after storing the object information and metadata updated for the specified time-series object into the Job, the asynchronous task execution module is used to add the JobID of the Job to the system table; The JobIDs of multiple types of Jobs are stored in the system table and sorted according to the creation time; The asynchronous task scheduling and execution module is used to perform: For a change transaction with successful submission, send a signal to the database background through a channel, call the database background to poll the system table, and obtain newly created JobIDs that have not started or are being executed; Load the Job based on the JobID, select the Job corresponding to the change transaction from the loaded Job, and for the selected Job, call the metadata cache update module to execute the Job for metadata caching; If an error occurs during the execution of the Job, determine the error type. If it is a non-retryable error, return the error and mark the Job as failed. If it is a retryable error, retry the execution of the Job. If the retry threshold is not reached or the execution is not successful, return the error and mark the Job as failed.

5. The asynchronous task-based timing metadata cache synchronization device according to claim 1, wherein The metadata cache update module is used to execute: Obtain the object information and metadata updated by the specified time series object stored in the Job, and send the object information and metadata updated by the specified time series object to the end where the metadata cache is located, and wait for the response from the end where the metadata cache is located. If the response is successful, mark the Job status as successful; otherwise, mark the Job status as failed.

6. A method for synchronizing time-series metadata cache based on asynchronous tasks, characterized in that, For caching time series metadata and synchronizing metadata cache through the time series metadata cache synchronization device based on asynchronous tasks as described in any one of claims 1-5, the method includes: The database receives an SQL statement for changing the metadata of a time series object from the application layer and creates a change transaction based on the SQL statement; For each change transaction, perform a change operation on the metadata of the specified time series object based on the SQL statement and commit the change transaction; For each change transaction, determine whether there is a metadata cache for the specified time series object. If so, create a Job for metadata synchronization cache, store the object information and metadata updated by the specified time series object in the Job, and set the metadata cache of the specified time series object to invalid; Trigger the database background to obtain the Jobs being executed or not executed and schedule the executable Jobs to be executed according to the type; For the successfully committed change transaction, obtain the corresponding executable Job, execute the Job for metadata caching, and send the object information and metadata updated by the specified time series object stored in the Job to the end where the metadata cache is located.

7. The method for synchronizing time series metadata cache based on asynchronous tasks according to claim 6, characterized in that, For each change transaction, perform a change operation on the metadata of the specified time series object based on the SQL statement, including the following: Parse the SQL statement, including syntax parsing and semantic parsing; Generate a plan based on the parsed SQL statement, including a logical plan and a physical plan; Execute the plan to perform a change operation on the metadata of the specified time series object; After verifying that the change operation is valid, write the updated metadata of the time series object into the system table; Commit the change transaction. If the change transaction is rolled back, the updated metadata written into the system table is rolled back. If the change transaction is successfully committed, the updated metadata is successfully written into the system table.

8. The method for synchronizing time-series metadata cache based on asynchronous tasks according to claim 6, wherein For each change transaction, during the execution of the SQL statement, determine whether there is a metadata cache for the specified time series object; If so, create a Job of type tsMetaCacheSync, store the object information and metadata updated by the specified time series object in the Job, where the object information includes the subordinate relationship of the time series object, and the updated metadata is read from the system table; Invalidate the metadata cache of the specified timing object; If the corresponding change transaction rolls back, the Job rolls back. If the corresponding change transaction is committed successfully, the Job is created successfully.

9. The method for synchronizing time-series metadata cache based on asynchronous tasks according to claim 6, characterized in that, For each change transaction, after storing the object information and metadata updated for the specified timing object into the Job, add the JobID of the Job to the system table; The JobIDs of multiple types of Jobs are stored in the system table and sorted by creation time; For a successfully committed change transaction, send a signal to the database background through the channel, call the database background to poll the system table, and obtain the newly created JobIDs that have not started or are in progress; Load the Job based on the JobID, select the Job corresponding to the change transaction from the loaded Job, and for the selected Job, execute the Job for metadata caching; If an error occurs during Job execution, determine the error type. If it is a non-retryable error, return the error and mark the Job as failed. If it is a retryable error, retry the Job execution. If the retry threshold is not reached or the execution is not successful, return the error and mark the Job as failed.

10. The method for synchronizing time-series metadata cache based on asynchronous tasks according to claim 6, wherein, Obtain the object information and metadata updated for the specified timing object stored in the Job, send the object information and metadata updated for the specified timing object to the end where the metadata cache is located, and then wait for the response from the end where the metadata cache is located. If the response is successful, mark the Job status as successful; otherwise, mark the Job status as failed.

Citation Information

Patent Citations

  • Data synchronization method and device, computer equipment, storage medium and program product

    CN114328561A

  • Data synchronization method and device

    CN114691631A