A cache method, device, equipment and medium for a storage and computing separation database

Caching metadata in the key-value pair method solves the problem of low metadata management efficiency under the storage-computing separation architecture, achieves efficient metadata access and improves system performance, and enhances the scalability and flexibility of the system.

CN118394803BActive Publication Date: 2024-09-17BEIJING SIWEIZONGHENG DATA TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410851471.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-28
Publication Date
2024-09-17
Estimated Expiration
2044-06-28

AI Technical Summary

Technical Problem

Under the storage-computing separation architecture, the metadata management mechanism in the existing technology is closed source and lacks a clear metadata caching strategy, resulting in insufficient metadata caching and affecting system performance.

Method used

The key-value pair (Key-Value Pair) method is used for metadata caching. By splicing the database ID and metadata table ID into a string as the key value, and using the record number as the value value, the key values ​​of the metadata table and index table are realized. Storage and cache management are performed through multi-level indexing mechanisms and shared memory to ensure data consistency and access efficiency.

Benefits of technology

It improves the access efficiency of metadata and system performance, realizes data consistency and efficient caching under the separation of storage and computing architecture, and enhances the scalability and elasticity of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118394803B
    Figure CN118394803B
Patent Text Reader

Abstract

The present invention provides a caching method, device, equipment and medium for a storage-computation separation database, which relates to the field of database technology, including: combining a database ID and a metadata table ID into a first string as a prefix for each piece of data in the metadata table, splicing the record number of each piece of data after the prefix as the key value of the metadata, taking the content of the metadata as the corresponding value, and obtaining the key-value pair of the metadata table; extracting the value of the index field corresponding to each record in each index table of the metadata table, splicing it into a second string, splicing the string after the prefix as the key value of the record, taking the row number of the record as the corresponding value, and obtaining the key-value pair of each index table of the metadata table. The present invention adopts a key-value pair method for metadata caching, realizes efficient caching of data consistency under a storage-computation separation architecture, and effectively improves the access efficiency and system performance of metadata.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of database technology, and in particular to a cache method, device, equipment and medium for a storage-computation separation database. Background Art

[0002] With the rapid development of big data, cloud computing and microservice architecture, traditional database systems are facing challenges in performance, scalability and flexibility. Compute-Storage Separation Architecture has emerged to achieve independent expansion and dynamic scheduling of resources by decoupling computing resources from storage resources. This architecture is widely used in cloud database services, distributed database systems and other fields.

[0003] Metadata (catalog) includes information such as tables, indexes, and views in the database, and is a key component of the normal operation and query optimization of the database system. Traditional database systems usually store metadata and data in the same instance. In the storage-computing separation architecture, metadata is stored on an independent metadata server, and computing nodes need to access metadata through remote procedures (RPC) and other methods. Therefore, its management and access efficiency are crucial to the overall performance of the system.

[0004] Some existing related technologies include: (1) Amazon Aurora: Amazon Aurora is a relational database service of AWS that implements a storage-computing separation architecture. Aurora ensures high availability and scalability of data by separating storage nodes and computing nodes and using multiple replicas and shared storage mechanisms. (2) Google Cloud Spanner: Google Cloud Spanner is a distributed database service of Google that has global consistency and high availability. Spanner achieves high-performance data management in a large-scale distributed environment through a multi-level storage and computing architecture. (3) Memcached and Redis: These two are widely used distributed caching systems that improve data access speed and system scalability by caching data on multiple nodes. (4) MySQL InnoDB: InnoDB is the storage engine of MySQL. It caches commonly used data pages and index pages through the buffer pool to improve data access speed.

[0005] However, in the existing methods, Aurora's metadata management mechanism is a closed-source implementation, and there is no clear metadata caching strategy; Panner uses a dedicated directory service to manage metadata and ensures metadata consistency through a distributed protocol, and its metadata caching is not optimized enough; Memcached and Redis are usually used for application layer caching, but not specifically for database metadata. InnoDB's caching mechanism is tightly coupled with the database instance, making it difficult to work efficiently under the storage and computing separation architecture. Summary of the invention

[0006] In view of this, the embodiments of the present application provide a caching method, device, equipment and medium for a storage-computing separation database. The embodiments of the present application adopt a key-value pair (KV pair) method to cache metadata, thereby realizing efficient caching of data consistency under a storage-computing separation architecture, and effectively improving metadata access efficiency and system performance.

[0007] The embodiment of the present application provides the following technical solution: a caching method for a storage-computation separation database, comprising:

[0008] The database ID and the metadata table ID are concatenated into a first character string, the first character string is used as a prefix of each piece of data content in the metadata table, the record number of each piece of data content in the metadata table is concatenated after the prefix, the concatenated first character string and the record number are used as a key value of the metadata, the data content of the metadata is used as a value corresponding to the key value, and a key-value pair of the metadata table is obtained; wherein the record number of the data content is used to represent a unique identifier of each piece of data content in the metadata table;

[0009] The value of the index field corresponding to each record in each index table of the metadata table is extracted, and the values ​​of all the index fields of the extracted record are concatenated into a second string in a set order, and the second string is concatenated after the prefix, and the concatenated first string and second string are used as a whole as the key value of the record, and the row number of the record is used as the value corresponding to the key value of the record, so as to obtain the key-value pairs of each index table of the metadata table.

[0010] According to an embodiment of the present application, the method further includes:

[0011] All data contents in the metadata table are divided into different pages according to different row numbers, and the data contents corresponding to the key value of the metadata of the row are stored in the page;

[0012] All records in the index table are intercepted according to the starting record key value given by the query and set as a page, and a plurality of records are stored in the page;

[0013] The cache page starting Key value of each page in the metadata table and the index table is sorted to form a sorted index, and the corresponding page is determined in the sorted index by a given Key value; wherein the page is used to represent a basic unit for storing cache data.

[0014] According to an embodiment of the present application, the method further includes:

[0015] The physical file numbers of the metadata table and the index table form a query table, and the cache data of the metadata table and the index table are indexed through the query table.

[0016] According to an embodiment of the present application, determining a corresponding page in the sorted index by a given Key value further includes:

[0017] Scan sequentially in the corresponding pages to query the target data; if the target data is not found, initiate an RPC request to the metadata server through the computing node, request the metadata of the corresponding page, and apply for a shared page, put the obtained metadata of the corresponding page into the shared page, and insert the starting key value of the shared page into the corresponding sorting index.

[0018] According to an embodiment of the present application, a binary search is used in the sorted index to determine the corresponding page through a given Key value.

[0019] According to an embodiment of the present application, the method further includes:

[0020] Put the database metadata and shared data into shared memory for global cache so that all processes on the computing node can share the cache data.

[0021] The metadata to be modified is locally cached before submission to isolate the metadata modification.

[0022] According to an embodiment of the present application, the method further includes:

[0023] When a computing node modifies metadata, it sends a metadata invalidation message to the metadata server at the transaction boundary and command boundary. Other computing nodes in the metadata server clear the corresponding metadata in the cache based on the metadata invalidation message and obtain the latest metadata from the metadata server again.

[0024] The present application also provides a cache device for a storage-computation separation database, including:

[0025] A first key-value pair generation module is used to concatenate a database ID and a metadata table ID into a first string, use the first string as a prefix of each piece of data content in the metadata table, concatenate the record number of each piece of data content in the metadata table after the prefix, use the concatenated first string and record number as a key value of the metadata, use the data content of the metadata as a value corresponding to the key value, and obtain a key-value pair of the metadata table; wherein the record number of the data content is used to represent the unique identifier of each piece of data content in the metadata table;

[0026] The second key-value pair generating module is used to extract the value of the index field corresponding to each record in each index table of the metadata table, splice the values ​​of all the index fields of the extracted record into a second string in a set order, splice the second string after the prefix, use the spliced ​​first string and second string as a whole as the key value of the record, use the row number of the record as the value corresponding to the key value of the record, and obtain the key-value pair of each index table of the metadata table.

[0027] 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 cache method for the storage-computation separation database when executing the computer program.

[0028] The present application also provides a computer-readable storage medium, which stores a computer program for executing the above-mentioned caching method of the storage-computation separation database.

[0029] Compared with the prior art, the beneficial effects that can be achieved by at least one of the above-mentioned technical solutions adopted in the embodiments of this specification include at least the following: the embodiments of the present invention adopt a key-value pair method to cache metadata, realize efficient caching of data consistency under the storage-computing separation architecture, and effectively improve the access efficiency and system performance of metadata. In addition, the embodiments of the present invention retain valid metadata in the shared memory to the greatest extent possible, add cache query through a multi-level index mechanism, and ensure the consistency of transactions through invalid messages. It makes it possible to remotely store metadata under the storage-computing separation architecture, ensuring the efficiency of access. The centralized storage of metadata remotely is the basis for further separation of data and metadata, making it possible for multiple computing systems to share metadata, and improving the elasticity of the system. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] 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.

[0031] Figure 1 It is a schematic diagram of a cache method for a storage and computing separation database according to an embodiment of the present invention;

[0032] Figure 2 It is a schematic diagram of the cache organization structure of the storage and computing separation database in an embodiment of the present invention;

[0033] Figure 3 Schematic diagram of a cache device of a storage and computation separation database according to an embodiment of the present invention;

[0034] Figure 4 It is a structural schematic diagram of the computer device of the present invention. DETAILED DESCRIPTION

[0035] The embodiments of the present application are described in detail below with reference to the accompanying drawings.

[0036] 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.

[0037] like Figure 1 As shown, an embodiment of the present invention provides a caching method for a storage-computation separation database, including:

[0038] S101. Concatenate the database ID and the metadata table ID into a first string, use the first string as a prefix of each piece of data content in the metadata table, concatenate the record number of each piece of data content in the metadata table after the prefix, use the concatenated first string and record number as a key value of the metadata, use the data content of the metadata as the value corresponding to the key value, and obtain a key-value pair of the metadata table; wherein the record number of the data content is used to represent the unique identifier of each piece of data content in the metadata table;

[0039] S102. Extract the value of the index field corresponding to each record in each index table of the metadata table, concatenate the values ​​of all the index fields of the extracted record into a second string in a set order, concatenate the second string after the prefix, use the concatenated first string and second string as a whole as the key value of the record, use the row number of the record as the value corresponding to the key value of the record, and obtain the key-value pairs of each index table of the metadata table.

[0040] The database architecture of storage-compute separation is a design pattern that separates the storage and computing functions of data to improve the scalability and flexibility of the database. Taking the traditional database PostgreSQL as an example, the metadata of the database (usually called catalog) is also stored in the database in the form of a data table (Table), and the metadata of each database may be different. The embodiment of the present invention proposes a method of mapping different metadata tables into a unified kv space, that is, a KV pair caching mechanism to achieve indiscriminate data storage, thereby improving the access speed of metadata and the scalability of the system.

[0041] The embodiment of the present invention clarifies an independently deployed metadata server and a cache mechanism based on a KV pair, and the specific implementation method is as follows:

[0042] (1) The database ID and metadata table ID are combined into a string as the prefix of the metadata table data content. In order to ensure the legitimacy of the key, the encoding technology is used to convert the mathematical and special characters involved into a readable string.

[0043] (2) For the metadata table, the record number of the data is added to the prefix as the key value of the metadata. The content of the record is stored as the value in the same way as the original database record.

[0044] (3) For each index table of metadata, the values ​​of all index fields of the corresponding record are combined into a string and appended to the prefix as the key value. The value stores the position of the corresponding record, that is, the row number.

[0045] Since index records are modified repeatedly, the key value of the same index will be remapped to a new location. Therefore, an index record will have multiple versions, which can be queried by using a number to represent different modification times. Using the above method, each metadata is mapped to a global unified address space in a unique way, and the corresponding content can be accessed by specifying the key value.

[0046] In specific implementation, the record number of the data content is used to represent the unique identifier of each data content in the metadata table. The unique identifier can be: (1) Primary Key: In a relational database, each table has a primary key, which is a field or a combination of multiple fields, used to uniquely identify each row of data in the table. (2) Record ID: In some systems, there may be an automatically generated record ID field to track the insertion order of each record or as a unique identifier for each record. (3) Sequence Number: In some database designs, a sequence number may be used to identify records. This sequence number is usually automatically increased according to the order in which the records are inserted. (4) Row Number: In some queries or reports, a row number may be assigned to each record for easy reference or sorting. (5) Unique Identifier (UID): In the absence of a traditional primary key, a special field such as UUID (Universally Unique Identifier) ​​may be used as the unique identifier of the record.

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

[0048] All data contents in the metadata table are divided into different pages according to different row numbers, and the data contents corresponding to the key value of the metadata of the row are stored in the page;

[0049] All records in the index table are intercepted according to the starting record key value given by the query and set as a page, and a plurality of records are stored in the page;

[0050] The cache page starting Key value of each page in the metadata table and the index table is sorted to form a sorted index, and the corresponding page is determined in the sorted index by a given Key value; wherein the page is used to represent a basic unit for storing cache data.

[0051] When implementing it, Figure 2 As shown. Page is the basic unit for storing cached data, storing records for a certain range of keys. For the original table of the metadata table, it is divided into different pages by row number. For the pages of the index table, a certain range is intercepted based on the query given starting key to form a page. An index cache page contains several records, which record the position and modification sequence number in the original table. For the data in the original table, it may also exist in multiple versions, and their row numbers are different.

[0052] For each table in the cache, TableIndex (index table) maintains an ordering of the starting key values ​​of all cache pages. Given a key value, you can use TableIndex to use binary search to determine whether it falls on a certain page, and then scan the page sequentially to finally determine whether it hits.

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

[0054] The physical file numbers of the metadata table and the index table form a query table, and the cache data of the metadata table and the index table are indexed through the query table.

[0055] In specific implementation, whether it is the metadata table, the original table or the index table, the cache data of the table is indexed by its physical file number (relnode). Taking the database PostgreSQL as an example, the database number plus the table space number plus the relnode uniquely identifies the data of a table. Using their combination as the key value, the TableIndex of the corresponding table can be found to complete all queries.

[0056] In one embodiment, the corresponding page is determined in the sorted index through a given Key value, and it also includes: sequentially scanning the corresponding page to query the target data; if the target data is not found, initiating an RPC request to the metadata server through the computing node, requesting the metadata of the corresponding page, and applying for a shared page, putting the obtained metadata of the corresponding page into the shared page, and inserting the starting key value of the shared page into the corresponding index table of the sorted index.

[0057] In one embodiment, the method further includes: placing the metadata and shared data of the database into a shared memory for global caching so that all processes on the computing node share the cached data; and locally caching the metadata to be modified before submission to isolate the modification of the metadata.

[0058] In specific implementation, by default, the computing node uses the global cache. The data in the global cache is placed in the shared memory, and all processes on the node share this cache data.

[0059] The database will modify metadata during transaction execution, and these uncommitted metadata are not allowed to be seen by other processes. Therefore, these data cannot directly modify the data in the metadata in the global cache, but use another memory cache structure that is the same as the global cache structure, which is equivalent to maintaining the metadata of its own changes in this local cache.

[0060] The decision of which cache to use is based on the table-level operation. For example, a transaction needs to access metadata table A and modify metadata table B. When accessing B, the local cache is used, while when accessing A, the global cache is still used. This approach retains the validity of the original cached data to the greatest extent and improves the utilization of the cache.

[0061] In practice, when a transaction is complete and the changes are ready to be permanently saved to the database, a commit operation is performed. At this point, the changes in the local cache are merged into the global cache and the database. If the transaction fails or needs to be undone, a rollback operation can be performed to undo all changes in the transaction and restore it to the state before the transaction started.

[0062] 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.

[0063] In one embodiment, the method also includes: when a computing node modifies the metadata, a metadata invalidation message is sent to the metadata server at the transaction boundary and the command boundary, and other computing nodes in the metadata server clear the corresponding metadata in the cache based on the metadata invalidation message, and re-acquire the latest metadata from the metadata server.

[0064] In database operations, transaction boundaries define the start and end of a transaction. When a compute node needs to modify metadata, the modification must be performed in the context of a transaction. Command boundaries refer to the start and end of a single database command.

[0065] In specific implementation, when the metadata is modified and is no longer valid, the cached metadata must be cleared to avoid data errors caused by using expired data.

[0066] The storage-computing separation database is an architecture that shares metadata across processes. When a computing node issues a modification operation on metadata, it needs to issue invalid messages at the transaction boundary and command boundary (in the PostgreSQL database, a command is an operation that splits the visibility of locally modified metadata within a transaction. If a command sequence number is not increased, the metadata modified in this command is also invisible to the current process.) These messages are sent to the metadata server. Other processes will receive these invalid messages and eliminate cached data. When the data needs to be read next time, the required metadata is re-read from the metaserver.

[0067] For simplicity, locally modified metadata will be written directly to the metadata server. When the local processing of the corresponding metadata invalidation message, the local metadata cache is cleared and the latest metadata is obtained from the metadata server again.

[0068] Taking the database PostgreSQL as an example, for most metadata tables, metadata modification will generate a new record, and the computing node uses the transaction ID and command ID in the record to identify whether to accept the record. This method is relatively simple and direct, and can also be further optimized.

[0069] Through this cache invalidation mechanism, the storage-computing separation database architecture can maintain cache consistency across multiple computing nodes even when the metadata is frequently modified.

[0070] The embodiments of the present invention mainly include: (1) mapping a traditional database, such as PostgreSQL's catalog, into a kv storage; (2) caching pages and indexes in memory; 3) using global and local caches to process data reading and writing respectively; 4) using an invalidation message mechanism to invalidate cached data. This method retains valid metadata in shared memory to the greatest extent possible, adds cache query through a multi-level index mechanism, and ensures transaction consistency through invalidation messages. This makes it possible to store metadata remotely under a storage-computing separation architecture, ensuring access efficiency. The centralized storage of metadata remotely is the basis for further separation of data and metadata, making it possible for multiple computing systems to share metadata, thereby improving the elasticity of the system.

[0071] Although PosgreSQL is mentioned as an example many times in this method, it is not limited to PosgreSQL databases or relational databases. Moreover, this method is a mechanism for implementing concurrency control, but it is not limited to multi-version concurrency control.

[0072] like Figure 3 As shown, the present application also provides a cache device 200 for a storage and computation separation database, comprising:

[0073] The first key-value pair generating module 201 is used to concatenate the database ID and the metadata table ID into a first character string, use the first character string as the prefix of each piece of data content in the metadata table, concatenate the record number of each piece of data content in the metadata table after the prefix, use the concatenated first character string and the record number as a whole as the key value of the metadata, use the data content of the metadata as the value corresponding to the key value, and obtain the key-value pair of the metadata table; wherein the record number of the data content is used to represent the unique identification of each piece of data content in the metadata table;

[0074] The second key-value pair generating module 202 is used to extract the value of the index field corresponding to each record in each index table of the metadata table, concatenate the values ​​of all the index fields of the extracted record into a second string according to a set order, concatenate the second string after the prefix, use the concatenated first string and second string as a whole as the key value of the record, use the row number of the record as the value corresponding to the key value of the record, and obtain the key-value pair of each index table of the metadata table.

[0075] In a specific implementation, the device also includes a page storage module, which is used to divide all data contents in the metadata table into different pages according to different row numbers, and the data content corresponding to the key value of the metadata row is stored in the page; all records in the index table are intercepted according to the set range of the starting record key value given by the query as a page, and a number of records are stored in the page; the cache page starting Key values ​​of each page in the metadata table and the index table are sorted to form a sorted index, and the corresponding page is determined in the sorted index through the given Key value; wherein, the page is used to represent a basic unit for storing cache data.

[0076] The page storage module is further used to form a query table with the physical file numbers of the metadata table and the index table, and to index the cache data of the metadata table and the index table through the query table.

[0077] The page storage module is also used to sequentially scan the corresponding pages to query the target data; if the target data is not found, an RPC request is initiated to the metadata server through the computing node to request the metadata of the corresponding page, and a shared page is applied for, the obtained metadata of the corresponding page is placed in the shared page, and the starting key value of the shared page is inserted into the corresponding sorting index.

[0078] In a specific implementation, the device also includes a two-level cache module, which is used to place the metadata and shared data of the database into a shared memory for global caching so that all processes on the computing node can share the cached data; the metadata to be modified is locally cached before submission to isolate the modification of the metadata.

[0079] In a specific implementation, the device also includes a cache invalidation control module, which is used to send a metadata invalidation message to the metadata server on the transaction boundary and the command boundary when the computing node modifies the metadata. Other computing nodes in the metadata server clear the corresponding metadata in the cache based on the metadata invalidation message and re-acquire the latest metadata from the metadata server.

[0080] This device is suitable for the storage-computing separation architecture mode, and can cache the centrally stored metadata locally on the computing cluster side. It can efficiently implement memory caching of all metadata and correctly ensure metadata consistency.

[0081] In one embodiment, a computer device is provided, such as Figure 4 As shown, it includes a memory 301, a processor 302, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the above-mentioned cache method of the storage-computation separation database is implemented.

[0082] Specifically, the computer device may be a computer terminal, a server or a similar computing device.

[0083] 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 cache method of the storage-computation separation database.

[0084] 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.

[0085] 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.

[0086] 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 cache method for a storage-computation separation database, characterized in that: include: The database ID and the metadata table ID are concatenated into a first character string, the first character string is used as a prefix of each piece of data content in the metadata table, the record number of each piece of data content in the metadata table is concatenated after the prefix, the concatenated first character string and the record number are used as a key value of the metadata, the data content of the metadata is used as a value corresponding to the key value, and a key-value pair of the metadata table is obtained; wherein the record number of the data content is used to represent a unique identifier of each piece of data content in the metadata table; Extracting the value of the index field corresponding to each record in each index table of the metadata table, splicing the values ​​of all the index fields of the extracted record into a second string in a set order, splicing the second string after the prefix, taking the spliced ​​first string and the second string as a whole as the key value of the record, taking the row number of the record as the value corresponding to the key value of the record, and obtaining the key-value pair of each index table of the metadata table; The method further comprises: All data contents in the metadata table are divided into different pages according to different row numbers, and the data contents corresponding to the key value of the metadata of the row are stored in the page; All records in the index table are intercepted according to the starting record key value given by the query and set as a page, and a plurality of records are stored in the page; Sorting the cache page start Key value of each page in the metadata table and the index table to form a sorted index, and determining the corresponding page in the sorted index by a given Key value; wherein the page is used to represent a basic unit for storing cache data; Determining the corresponding page in the sorted index by a given Key value also includes: Scan sequentially in the corresponding pages to query the target data; if the target data is not found, initiate an RPC request to the metadata server through the computing node, request the metadata of the corresponding page, and apply for a shared page, put the obtained metadata of the corresponding page into the shared page, and insert the starting key value of the shared page into the corresponding sorting index.

2. The cache method of the storage-computation separation database according to claim 1, characterized in that: The method further comprises: The physical file numbers of the metadata table and the index table form a query table, and the cache data of the metadata table and the index table are indexed through the query table.

3. The cache method of the storage-computation separation database according to claim 1, characterized in that: By using a given Key value, a binary search is performed in the sorted index to determine the corresponding page.

4. The cache method of the storage-computation separation database according to claim 1, characterized in that: The method further comprises: Put the database metadata and shared data into shared memory for global cache so that all processes on the computing node can share the cache data. The metadata to be modified is locally cached before submission to isolate the metadata modification.

5. The cache method of the storage-computation separation database according to claim 1, characterized in that: The method further comprises: When a computing node modifies metadata, it sends a metadata invalidation message to the metadata server at the transaction boundary and command boundary. Other computing nodes in the metadata server clear the corresponding metadata in the cache based on the metadata invalidation message and obtain the latest metadata from the metadata server again.

6. A cache device for a storage and computing separation database, characterized in that: include: A first key-value pair generation module is used to concatenate a database ID and a metadata table ID into a first string, use the first string as a prefix of each piece of data content in the metadata table, concatenate the record number of each piece of data content in the metadata table after the prefix, use the concatenated first string and record number as a key value of the metadata, use the data content of the metadata as a value corresponding to the key value, and obtain a key-value pair of the metadata table; wherein the record number of the data content is used to represent the unique identifier of each piece of data content in the metadata table; A second key-value pair generating module is used to extract the value of the index field corresponding to each record in each index table of the metadata table, splice the values ​​of all the index fields of the extracted record into a second string according to a set order, splice the second string after the prefix, use the spliced ​​first string and the second string as a whole as the key value of the record, use the row number of the record as the value corresponding to the key value of the record, and obtain the key-value pair of each index table of the metadata table; It also includes a page storage module, which is used to divide all data contents in the metadata table into different pages according to different row numbers, and store the data content corresponding to the key value of the metadata of the row in the page; intercept all records in the index table according to the query given starting record key value and set the range as a page, and store a number of records in the page; sort the cache page starting key value of each page in the metadata table and the index table to form a sorting index, and determine the corresponding page in the sorting index through the given key value; wherein the page is used to represent a basic unit for storing cache data; The page storage module is also used to sequentially scan the corresponding pages to query the target data; if the target data is not found, an RPC request is initiated to the metadata server through the computing node to request the metadata of the corresponding page, and a shared page is applied for, the obtained metadata of the corresponding page is placed in the shared page, and the starting key value of the shared page is inserted into the corresponding sorting index.

7. 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 cache method for the storage-computation separation database according to any one of claims 1 to 5 is implemented.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program for executing the cache method for a storage-computation separation database according to any one of claims 1 to 5.