A metadata caching method, device, equipment and medium for distributed database
Through a distributed database system between the coordinator and participants, the coordinator processes metadata operations and dispatches transaction execution plans, and participants execute transactions in local caches, solving the high latency of metadata management in a storage-computing separation architecture. , high load and consistency issues, and achieves efficient metadata caching and consistency management.
Patent Information
- Application Number
- CN202410925120.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-11
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2044-07-11
AI Technical Summary
In a storage-computing separation architecture, metadata management suffers from high latency, high load, and consistency problems. It is difficult for existing technologies to effectively cache metadata, causing system performance to be affected.
The coordinator obtains metadata and processes related operations, generates transaction execution plans, and dispatches metadata information and plans to participants. Participants execute transactions in local caches, clear invalid messages, and publish them to the metadata server to ensure Data consistency.
The frequency of access to the metadata server is reduced, system pressure is reduced, performance is improved, and metadata consistency is ensured.
Smart Images

Figure CN118467592B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of database technology, and in particular to a metadata caching method, device, equipment and medium for a distributed database. Background Art
[0002] In modern database systems, data storage and computing are usually tightly coupled, which means that data storage and computing resources are jointly managed and operated. However, with the explosive growth of data volume and the increasing demand for computing resources, the storage-computing separation architecture has gradually become a trend. In this architecture, data storage and computing resources are separated to different servers, which can flexibly expand storage and computing capabilities and better optimize resource utilization.
[0003] In the storage-computing separation architecture, metadata management becomes particularly important. Metadata includes data table structure, indexes, statistical information, etc., and is the key to the efficient operation of the database system. However, since metadata is usually stored on independent metadata servers, computing nodes need to frequently access these centrally stored metadata, which will bring the following problems: (1) High latency: Every time a computing node needs metadata, it needs to obtain it from the metadata server. The delay in network communication will significantly affect system performance. (2) High load: The metadata server needs to process requests from multiple computing nodes, which can easily become a bottleneck of the system. (3) Consistency issues: Concurrent access and modification of metadata by multiple computing nodes may lead to consistency issues. Dealing with these consistency issues will further increase the complexity and overhead of the system.
[0004] For example: PostgreSQL. As a widely used open source relational database management system, PostgreSQL's architecture design is mainly oriented towards the traditional database model of storage and computing integration. It has some shortcomings in dealing with storage and computing separation and efficient metadata management. In the storage and computing separation architecture, every time the computing node needs to access or modify metadata, it must communicate with the metadata server through the network. This frequent network communication will cause high latency and affect system performance. PostgreSQL lacks an effective mechanism to cache this metadata, and thus cannot significantly reduce this latency. Greenplum is a widely used and powerful data product in the industry. Faced with the storage and computing separation architecture, it still faces similar problems as PostgreSQL.
[0005] Couchbase. It has a built-in cache layer to improve data access speed, support high availability and flexible data models. However, it requires additional mechanisms and costs to ensure data consistency, and the system is highly complex.
[0006] Memcached and Redis. These two products are efficient memory cache systems that can significantly reduce direct requests to metadata servers and support distributed deployment. However, they cannot guarantee the consistency between the cache and the metadata server, especially in the case of high-concurrency modifications, which increases system complexity and operation and maintenance costs. Summary of the invention
[0007] In view of this, the embodiments of the present application provide a metadata caching method, apparatus, device and medium for a distributed database, which achieves high efficiency while ensuring data consistency and improves system performance.
[0008] The embodiment of the present application provides the following technical solution: a metadata caching method for a distributed database, comprising:
[0009] The coordinator obtains metadata from the metadata server and processes operations related to the metadata; the related operations include creation, deletion, modification of metadata tables, and generation of transaction execution plans based on the metadata;
[0010] The coordinator distributes the metadata information and the generated transaction execution plan to all participants. All participants access the data in the shared storage according to the metadata information and the transaction execution plan, execute the corresponding transaction, and output the transaction execution result.
[0011] According to an embodiment of the present application, the method further includes:
[0012] The coordinator identifies invalid metadata messages in the system cache, the relationship cache, and the page cache, and clears the metadata corresponding to the invalid messages;
[0013] The invalid message is stored in an invalid message set, and the invalid message set is sent to the metadata server, and the metadata server stores the invalid message set in a local session space isolated from other transactions;
[0014] When the current transaction or subtransaction is committed, the metadata server publishes the entire set of invalid message sets stored in the local session space to a global invalid message queue.
[0015] According to an embodiment of the present application, the method further includes:
[0016] If the current transaction or subtransaction is canceled, the metadata server destroys the invalid message set stored in the local session space.
[0017] According to an embodiment of the present application, the method further includes:
[0018] When executing the corresponding transaction, the participant compares the global variable, local variable and local invalid message record value of the invalid message. If the local invalid message record value is smaller than the global variable or local variable of the invalid message, an invalid message queue update request is immediately initiated to the metadata server, and the invalid message clearing operation is performed, and the local invalid message record value is updated at the same time; wherein, the global variable of the invalid message is used to represent the global queue position or identifier of the next invalid message to be processed; and the local variable is used to represent the local queue position or identifier of the next invalid message to be processed.
[0019] According to an embodiment of the present application, the coordinator obtains metadata through a metadata server and processes operations related to the metadata, further comprising:
[0020] The coordinator obtains metadata from the metadata server, creates a metadata table, locally caches multiple metadata tables to generate a relationship cache, and serializes the generated or updated relationship cache and saves it as a local file;
[0021] Traverse the syntax tree to determine the metadata database table that the transaction needs to access, read the corresponding metadata information from the local file of the relationship cache according to the determined metadata database table, and distribute the metadata information to the participants.
[0022] According to an embodiment of the present application, the method further includes:
[0023] When the coordinator modifies the metadata table, it generates an invalid message, which indicates the modified metadata table and the modified information in the table;
[0024] At the command boundary, the coordinator applies local invalidation messages and collects the invalidation messages into a hash table; wherein the hash table is defined to track metadata modifications;
[0025] When generating a transaction execution plan, scan the transaction execution plan table to determine the metadata table to be accessed;
[0026] According to the Hash table, in each metadata table to be accessed, the earliest metadata modification record is determined, and the metadata modification record is distributed to the participant.
[0027] According to an embodiment of the present application, the coordinator distributes metadata information and the generated transaction execution plan to all participants, further comprising:
[0028] The coordinator distributes the local invalid message and the maximum local invalid message record value currently received to the participant;
[0029] The participant's local application receives the invalid message, clears the metadata corresponding to the invalid message, and records the maximum local invalid message record value received.
[0030] The present application also provides a metadata cache device for a distributed database, including: a metadata server, a coordinator, and a participant;
[0031] The coordinator is used to obtain metadata from the metadata server and process metadata-related operations; the related operations include creation, deletion, modification of metadata tables and generation of transaction execution plans based on the metadata; the coordinator is also used to distribute metadata information and generated transaction execution plans to all participants;
[0032] The participant is used to access the data in the shared storage according to the metadata information and the transaction execution plan, execute the corresponding transaction, and output the transaction execution result.
[0033] The present application also provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned metadata caching method for the distributed database when executing the computer program.
[0034] The present application also provides a computer-readable storage medium, which stores a computer program for executing the above-mentioned metadata caching method for a distributed database.
[0035] Compared with the prior art, the beneficial effects achieved by at least one of the above technical solutions adopted in the embodiments of this specification include at least the following: the embodiment of the present invention adopts the method of generating and distributing metadata by the coordinator, which minimizes the number and frequency of participants accessing the metadata server to obtain the latest metadata and invalid messages, reduces the access to the metadata server as much as possible, improves the speed and reduces the pressure on the metadata server. At the same time, this method ensures the consistency of metadata. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0037] Figure 1 It is a schematic diagram of a metadata caching method flow of a distributed database according to an embodiment of the present invention;
[0038] Figure 2It is a schematic diagram of the architecture of a metadata cache device of a distributed database according to an embodiment of the present invention;
[0039] Figure 3 It is a structural schematic diagram of the computer device of the present invention. DETAILED DESCRIPTION
[0040] The embodiments of the present application are described in detail below with reference to the accompanying drawings.
[0041] The following describes the implementation methods of the present application through specific examples, and those skilled in the art can easily understand other advantages and effects of the present application from the contents disclosed in this specification. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The present application can also be implemented or applied through other different specific implementation methods, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present application. It should be noted that, in the absence of conflict, the following embodiments and the features in the embodiments can be combined with each other. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work belong to the scope of protection of the present application.
[0042] like Figure 1 As shown, an embodiment of the present invention provides a metadata caching method for a distributed database, comprising:
[0043] S101. The coordinator obtains metadata through the metadata server and processes the metadata-related operations; the related operations include creating, deleting, modifying metadata tables and generating transaction execution plans based on the metadata;
[0044] S102. The coordinator distributes the metadata information and the generated transaction execution plan to all participants. All participants access the data in the shared storage according to the metadata information and the transaction execution plan, execute corresponding transactions, and output transaction execution results.
[0045] In the two-phase commit protocol (2PC) in distributed database systems, participants and coordinators are two important roles. The coordinator is responsible for coordinating operations such as commit or rollback of distributed transactions. It is usually a central node or service responsible for managing the entire transaction process. Participants are nodes or services that participate in distributed transactions. They perform specific transaction operations and communicate with the coordinator to determine the final result of the transaction.
[0046] The embodiment of the present invention provides a metadata caching method for a distributed database, which achieves high efficiency while ensuring data consistency. Specifically, in a shared metadata and data storage mode, the coordinator is responsible for metadata-related operations, such as creating / deleting tables, etc. It is also responsible for generating a transaction execution plan based on metadata and distributing the transaction execution plan to all participants for joint completion. Participants access data on the shared storage based on metadata information and complete the execution results, so as to reduce the access to the metadata server as much as possible, improve the speed and reduce the pressure on the metadata server.
[0047] In one embodiment, the method further comprises:
[0048] The coordinator identifies invalid metadata messages in the system cache, the relationship cache, and the page cache, and clears the metadata corresponding to the invalid messages;
[0049] The invalid message is stored in an invalid message set, and the invalid message set is sent to the metadata server, and the metadata server stores the invalid message set in a local session space isolated from other transactions;
[0050] When the current transaction or subtransaction is committed, the metadata server publishes the entire set of invalid message sets stored in the local session space to a global invalid message queue.
[0051] Since the computing cluster will try to invalidate the corresponding metadata when modifying metadata, it is necessary to gradually collect the original invalid messages such as syscache (system cache), relcache (Relation Cache), and page cache data.
[0052] In the specific implementation, during the CommandCounterIncrement process, the following processing will be done:
[0053] (1) Find out the invalid messages of the page cache and eliminate the local page cache, including the index cache. Furthermore, store the invalid messages of the page cache into the invalid message set.
[0054] (2) Send the entire set of invalid messages to the metadata server. The metadata server currently only places the messages in the session's own space, and other transactions cannot retrieve these messages.
[0055] (3) When a transaction or subtransaction is committed, the metadata server publishes the invalid message of the session to the global invalid message queue.
[0056] In one embodiment, the method further includes: if the current transaction or subtransaction is canceled, the metadata server destroys the invalid message set stored in the local session space.
[0057] In specific implementation, uncommitted data can be written only locally, and written to the metadata server when it is committed. In addition, when the memory space is insufficient, part of the cached data can be written to the disk.
[0058] In one embodiment, the method further comprises:
[0059] When executing the corresponding transaction, the participant compares the global variable, local variable and local invalid message record value of the invalid message. If the local invalid message record value is smaller than the global variable or local variable of the invalid message, an invalid message queue update request is immediately initiated to the metadata server, and the invalid message clearing operation is performed, and the local invalid message record value is updated at the same time; wherein, the global variable of the invalid message is used to represent the global queue position or identifier of the next invalid message to be processed; and the local variable is used to represent the local queue position or identifier of the next invalid message to be processed.
[0060] Since the transaction needs to obtain the latest metadata during processing, the participants will try to receive all invalid messages from the metadata server. In specific implementation, first compare globalInvalmsgNextQD (global variable), localInvalmsgNextQD (local variable) and the local invalid message record value. If the value of the local record is too large, there is no need to initiate a request immediately, which means that the local invalid message queue is already the latest, so there is no need to initiate a new request immediately. In this case, the transaction can continue to process without immediately requesting new invalid messages from the metadata server, which can reduce network communication and improve efficiency. Otherwise, continue to obtain messages from the metadata server and then perform invalid operations. At the same time, record the latest value in the corresponding cache to obtain the latest local invalid message record value.
[0061] In one embodiment, the coordinator obtains metadata through a metadata server and processes operations related to the metadata, further comprising:
[0062] The coordinator obtains metadata from the metadata server, creates a metadata table, locally caches multiple metadata tables to generate a relationship cache, and serializes the generated or updated relationship cache and saves it as a local file;
[0063] Traverse the syntax tree to determine the metadata database table that the transaction needs to access, read the corresponding metadata information from the local file of the relationship cache according to the determined metadata database table, and distribute the metadata information to the participants.
[0064] In specific implementation, relcache (relationship cache) consists of information from multiple metadata tables. It is time-consuming to establish this information, so the coordinator distributes the information of the relationship cache directly to the participants to reduce the frequency of participants' access to the metadata server. Since relcache itself is also relatively large, relcache is a cache composed of information from multiple metadata tables. It may include metadata such as table structure, index information, view definition, etc. Therefore, for efficiency and recoverability, each time relcache is generated, it will be serialized and stored in a local file. In this way, the system can reload Relcache from the local file during startup or fault recovery. In the process of generating a transaction execution plan, the syntax tree is traversed to find the database table that needs to be accessed, the relcache data is read from the local, and then sent to the participants, so that the participants can use these metadata to access the data on the shared storage.
[0065] On the other hand, when relcache changes, such as table structure updates or index additions / deletions, relcache also needs to be updated to reflect these changes. In order to ensure that all participants use the latest metadata, the system will send invalidation messages to all participants when relcache changes. After receiving the invalidation message, the participant executes the invalidation message and deletes the relcache cache and the locally stored relcache local files to ensure that the latest metadata is reloaded at the next query or operation. This mechanism ensures that the participants of the system can efficiently access the latest metadata, while reducing the dependence on and access frequency of the central metadata server, and improving the overall performance and scalability of the system.
[0066] In one embodiment, the method further comprises:
[0067] When the coordinator modifies the metadata table, it generates an invalid message, which indicates the modified metadata table and the modified information in the table;
[0068] At the command boundary, the coordinator applies local invalidation messages and collects the invalidation messages into a hash table; wherein the hash table is defined to track metadata modifications;
[0069] When generating a transaction execution plan, scan the transaction execution plan table to determine the metadata table to be accessed;
[0070] According to the Hash table, in each metadata table to be accessed, the earliest metadata modification record is determined, and the metadata modification record is distributed to the participant.
[0071] In this embodiment, when a metadata database table changes, it is necessary to use session-level cache, and at the same time, it is necessary to avoid using expired data. This embodiment is achieved by tracking changes in metadata. The specific steps are as follows:
[0072] In the process of collecting invalid messages, it is identified which metadata entries have changed.
[0073] For metadata being modified, its intermediate results cannot be seen by other concurrent processes on the local machine, otherwise incorrect results will be generated. When this part of the data is identified, in order to ensure that the metadata being modified is not visible to other concurrent processes on the local machine, it is necessary to enable caching at the session level to isolate the metadata views of different sessions. The specific operation process is as follows:
[0074] 1. The coordinator records an invalid message during the modification process. The invalid message indicates which record in which metadata table has been modified.
[0075] 2. Apply local invalidation messages on command boundaries to ensure that the current session uses the latest metadata. At the same time, these changes are collected into a hash table, which is recorded as MetaChange to track metadata modifications.
[0076] 3. In the process of generating a transaction execution plan, scan the plan table to find the metadata table to be accessed.
[0077] 4. For each metadata table, find the earliest modified metadata and distribute it to the participants to ensure that the participants can obtain the latest metadata.
[0078] 5. If a participant finds that a metadata table has been modified, the local cache needs to be used. If the metadata change adds new data, the participant also needs to invalidate the corresponding page cache to avoid using outdated data.
[0079] In this way, the system ensures that each session has access to a consistent metadata view even when metadata is being modified, preventing data inconsistencies or erroneous results caused by concurrent modifications, thereby ensuring data consistency.
[0080] In one embodiment, the coordinator distributes the metadata information and the generated transaction execution plan to all participants, and also includes:
[0081] The coordinator distributes the local invalid message and the maximum local invalid message record value currently received to the participant;
[0082] The participant's local application receives the invalid message, clears the metadata corresponding to the invalid message, and records the maximum local invalid message record value received.
[0083] In this embodiment, in the process of dispatching the transaction execution plan, the coordinator also needs to send the local invalid message to the participants to keep the metadata information synchronized. The specific implementation includes:
[0084] 1. The coordinator traverses the invalid messages accumulated by the local transaction, finds out the undistributed parts, and packages them and sends them to the participants.
[0085] 2. The largest invalid message number that the coordinator has received (the largest invalid message number, that is, the largest local invalid message record value mentioned above) is also distributed to the participants.
[0086] 3. After receiving these invalid messages, the participants will apply locally and eliminate the corresponding metadata.
[0087] 4. The participant records the largest invalid message number.
[0088] 5. When it is necessary to pull invalid messages from the metadata server, as long as the local invalid message number is greater than the maximum invalid message number sent, it means that the local data has met the freshness requirements and will not be pulled for the time being.
[0089] The embodiments of the present invention mainly include: (1) Collection and application of invalid messages. Invalid messages are collected on the metadata change path, and local and global messages are distinguished; (2) Relationship caching, generation and distribution. Frequently used relationship caches are received and cached to avoid accessing the metadata server; (3) Collection and application of metadata changes. Local changes in metadata are recorded, appropriate caches are selected and correctness is guaranteed; (4) Distribution and minimization of invalid messages. Changing metadata is used correctly and the number of accesses to the metadata server is reduced. The embodiments of the present invention are designed for the architecture of storage and computing separation and shared metadata servers. It can perform localized and efficient memory caching of centrally stored metadata on the computing cluster side, thereby obtaining performance similar to that of a storage and computing integrated database.
[0090] like Figure 2 As shown, the present application also provides a metadata cache device for a distributed database, including: a metadata server, a coordinator and a participant;
[0091] The coordinator is used to obtain metadata from the metadata server and process metadata-related operations; the related operations include creation, deletion, modification of metadata tables and generation of transaction execution plans based on the metadata; the coordinator is also used to distribute metadata information and generated transaction execution plans to all participants;
[0092] The participant is used to access the data in the shared storage according to the metadata information and the transaction execution plan, execute the corresponding transaction, and output the transaction execution result.
[0093] In a specific implementation, the coordinator is also used to identify invalid metadata messages in the system cache, relationship cache, and page cache, and clear the metadata corresponding to the invalid messages; store the invalid messages in an invalid message set, and send the invalid message set to the metadata server, and the metadata server is used to store the invalid message set in a local session space isolated from other transactions; when the current transaction or subtransaction is committed, the metadata server publishes the full set of messages of the invalid message set stored in the local session space to the global invalid message queue.
[0094] In a specific implementation, if the current transaction or subtransaction is canceled, the metadata server destroys the invalid message set stored in the local session space.
[0095] In specific implementation, when executing the corresponding transaction, the participant compares the global variable, local variable and local invalid message record value of the invalid message. If the local invalid message record value is smaller than the global variable or local variable of the invalid message, an invalid message queue update request is immediately initiated to the metadata server, and the invalid message clearing operation is performed, and the local invalid message record value is updated at the same time; wherein, the global variable of the invalid message is used to represent the global queue position or identifier of the next invalid message to be processed; and the local variable is used to represent the local queue position or identifier of the next invalid message to be processed.
[0096] In the specific implementation, the coordinator obtains metadata through the metadata server, creates a metadata table, locally caches multiple metadata tables to generate a relationship cache, serializes the generated or updated relationship cache and saves it as a local file; traverses the syntax tree to determine the metadata database table that the transaction needs to access, reads the corresponding metadata information from the local file of the relationship cache according to the determined metadata database table, and distributes the metadata information to the participants.
[0097] In specific implementation, when the coordinator modifies the metadata table, it generates an invalid message, which indicates the modified metadata table and the modified information in the table; at the command boundary, the coordinator applies the local invalid message and collects the invalid message into a Hash table; wherein the Hash table is defined to track metadata modifications; when generating a transaction execution plan, the transaction execution plan table is scanned to determine the metadata table to be accessed; according to the Hash table, in each metadata table to be accessed, the earliest metadata modification record is determined, and the metadata modification record is distributed to the participants.
[0098] During the specific implementation, the coordinator distributes the local invalid message and the maximum local invalid message record value currently received to the participant; the participant's local application receives the invalid message, clears the metadata corresponding to the invalid message, and records the maximum local invalid message record value received.
[0099] This embodiment adopts the method of generating and distributing metadata by the coordinator, which minimizes the number and frequency of participants accessing the metadata server to obtain the latest metadata and invalid messages, while ensuring the consistency of metadata.
[0100] In one embodiment, a computer device is provided, such as Figure 3 As shown, it includes a memory 201, a processor 202, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the above-mentioned metadata caching method of the distributed database is implemented.
[0101] Specifically, the computer device may be a computer terminal, a server or a similar computing device.
[0102] In this embodiment, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program for executing the above-mentioned metadata caching method for a distributed database.
[0103] Specifically, computer-readable storage media include permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. Information can be computer-readable instructions, data structures, program modules or other data. Examples of computer-readable storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable storage media does not include temporary computer-readable media (transitory media), such as modulated data signals and carrier waves.
[0104] Obviously, those skilled in the art should understand that the modules or steps of the above-mentioned embodiments of the present invention can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. In this way, the embodiments of the present invention are not limited to any specific combination of hardware and software.
[0105] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A metadata caching method for a distributed database, characterized in that: include: The coordinator obtains metadata from the metadata server and processes operations related to the metadata; The related operations include creation, deletion, modification of metadata tables and generation of transaction execution plans based on the metadata; The coordinator distributes the metadata information and the generated transaction execution plan to all participants. All participants access the data in the shared storage according to the metadata information and the transaction execution plan, execute the corresponding transaction, and output the transaction execution result. The method further comprises: The coordinator identifies invalid metadata messages in the system cache, the relationship cache, and the page cache, and clears the metadata corresponding to the invalid messages; The invalid message is stored in an invalid message set, and the invalid message set is sent to the metadata server, and the metadata server stores the invalid message set in a local session space isolated from other transactions; When the current transaction or subtransaction is committed, the metadata server publishes the entire set of invalid message sets stored in the local session space to a global invalid message queue; The method further comprises: when executing the corresponding transaction, the participant compares the global variable, local variable and local invalid message record value of the invalid message; if the local invalid message record value is smaller than the global variable or local variable of the invalid message, then immediately initiates an invalid message queue update request to the metadata server, executes the invalid message clearing operation, and updates the local invalid message record value at the same time; wherein the global variable of the invalid message is used to represent the global queue position or identifier of the next invalid message to be processed; and the local variable is used to represent the local queue position or identifier of the next invalid message to be processed; The coordinator obtains metadata from the metadata server and processes operations related to the metadata, including: The coordinator obtains metadata from the metadata server, creates a metadata table, locally caches multiple metadata tables to generate a relationship cache, and serializes the generated or updated relationship cache and saves it as a local file; Traverse the syntax tree to determine the metadata database table that the transaction needs to access, read the corresponding metadata information from the local file of the relationship cache according to the determined metadata database table, and distribute the metadata information to the participants.
2. The metadata caching method for a distributed database according to claim 1, characterized in that: The method further comprises: If the current transaction or subtransaction is canceled, the metadata server destroys the invalid message set stored in the local session space.
3. The metadata caching method for a distributed database according to claim 1, characterized in that: The method further comprises: When the coordinator modifies the metadata table, it generates an invalid message, which indicates the modified metadata table and the modified information in the table; At the command boundary, the coordinator applies local invalidation messages and collects the invalidation messages into a hash table; wherein the hash table is defined to track metadata modifications; When generating a transaction execution plan, scan the transaction execution plan table to determine the metadata table to be accessed; According to the Hash table, in each metadata table to be accessed, the earliest metadata modification record is determined, and the metadata modification record is distributed to the participant.
4. The metadata caching method for a distributed database according to claim 1, characterized in that: The coordinator distributes metadata information and the generated transaction execution plan to all participants, including: The coordinator distributes the local invalid message and the maximum local invalid message record value currently received to the participant; The participant's local application receives the invalid message, clears the metadata corresponding to the invalid message, and records the maximum local invalid message record value received.
5. A metadata caching device for a distributed database, implementing the metadata caching method for a distributed database as claimed in any one of claims 1 to 4, characterized in that: include: metadata servers, coordinators, and participants; The coordinator is used to obtain metadata through the metadata server and process related operations of the metadata; The related operations include creation, deletion, modification of metadata tables and generation of transaction execution plans based on the metadata; the coordinator is also used to distribute metadata information and generated transaction execution plans to all participants; The participant is used to access the data in the shared storage according to the metadata information and the transaction execution plan, execute the corresponding transaction, and output the transaction execution result.
6. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the metadata caching method for a distributed database according to any one of claims 1 to 4 is implemented.
7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program for executing the metadata caching method for a distributed database according to any one of claims 1 to 4.
