Database operation method, system and computer cluster

By creating a session temporary table on disk that is bound to a global temporary table for each session in the distributed database, the problem of metadata loss caused by data node restarts in existing technologies is solved, thus achieving data operation persistence and stability and avoiding resource waste.

CN116842080BActive Publication Date: 2026-02-06SHENZHEN HUAWEI CLOUD COMPUTING TECHNOLOGIES CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310631037.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-30
Publication Date
2026-02-06
Estimated Expiration
2043-05-30

AI Technical Summary

Technical Problem

In distributed databases, the metadata of global temporary tables is stored in memory, which leads to the loss of metadata when data nodes restart, resulting in resource waste and business interruption.

Method used

By creating a session temporary table in the cloud platform that is bound to a global temporary table for each session, and storing the table file and metadata of the session temporary table on disk, the persistence of data operations is ensured and data loss is avoided.

Benefits of technology

It improves the stability of distributed databases, avoids resource waste, and ensures business continuity and efficient operation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116842080B_ABST
    Figure CN116842080B_ABST
Patent Text Reader

Abstract

The embodiment of the application provides a database operation method, system and computer device, the method is applied to the cloud platform, and comprises the following steps: a coordination node receives a data operation request sent by a user end through a target session; the coordination node determines whether a session temporary table created for a global temporary table and belonging to the target session exists at present, wherein metadata corresponding to the session temporary table is stored in a disk of a data node; in the case that it is determined that the session temporary table does not exist, the coordination node creates the session temporary table in a target data node in a plurality of data nodes, and sends the data operation request to the target data node; in the case that it is determined that the session temporary table exists, the coordination node sends the data operation request to the target data node, and the data operation request is used to instruct the target data node to perform data operation on the session temporary table according to the target data node. By adopting the database operation method provided by the application, the stability of the distributed database can be improved, and resource waste can be avoided.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of cloud computing, and particularly relates to a database operation method and system and a computer cluster. BACKGROUND

[0002] A global temporary table is a table used to retain temporary data or intermediate data in a database, and table structure and table data of the global temporary table are stored persistently in a disk. The global temporary table can be used commonly by multiple sessions, and metadata of data operation of the global temporary table by each session is stored in a memory.

[0003] In a distributed database, the global temporary table is stored in multiple data nodes in a distributed manner. Since the metadata of the global temporary table related to a session is stored in the memory, restart of any data node in the multiple data nodes will cause the metadata of the global temporary table to be lost. Thus, a business related to the global temporary table can need to be re-executed to recover the lost metadata, and thus resource waste of the data node is caused. SUMMARY

[0004] Embodiments of the present application provide a database operation method, system and computer cluster, which can improve stability of a distributed database and avoid resource waste. The corresponding technical solutions are as follows.

[0005] In a first aspect, a database operation method is provided. The method is applied to a cloud platform, the cloud platform includes a coordination node and multiple data nodes, and a database of the cloud platform is distributed in the multiple data nodes. The method includes the following steps.

[0006] The coordination node receives a data operation request sent by a user end through a target session, and the data operation request is used for data operation on a global temporary table in a distributed database. The coordination node determines whether a session temporary table created for the global temporary table and belonging to the target session exists at present, wherein the metadata corresponding to the session temporary table is stored in a disk of a data node. In a case where it is determined that the session temporary table does not exist, the coordination node creates the session temporary table in a target data node in the multiple data nodes, and sends the data operation request to the target data node. In a case where it is determined that the session temporary table exists, the coordination node sends the data operation request to the target data node, and the data operation request is used to instruct the target data node to perform data operation on the session temporary table according to the target data node.

[0007] In the scheme shown in the present application, for each session, a session temporary table bound with the global temporary table can be created, the created session temporary table has the same table structure as the global temporary table, and belongs to a persistent temporary table, that is, the table file and metadata corresponding to the session temporary table can be stored in the disk. When the data node receives the data operation request sent by the user end through the target session, the data operation of the created session temporary table can be performed according to the data operation request. In this way, the data operation of the global temporary table can be converted into the operation of the session temporary table. Since the corresponding table file and metadata of the session temporary table can be persistently stored in the disk, even if the data node restarts, no data loss will occur, and thus the stability of the distributed database can be improved.

[0008] In an implementable manner, the coordination node determines whether a session temporary table created for the global temporary table and belonging to the target session currently exists, comprising:

[0009] The coordination node determines whether the session temporary table has table creation information stored locally, and the table creation information includes the session identifier of the target session and the table identifier corresponding to the global temporary table.

[0010] In the scheme shown in the present application, the coordination node can store the table creation information of the session temporary table created for the global temporary table and belonging to the target session. The table creation information includes the session identifier of the target session and the table identifier corresponding to the global temporary table. In this way, after receiving the data operation request, the coordination node can determine whether the session temporary table bound with the global temporary table is established in the distributed database system according to the session identifier corresponding to the session sending the data operation request and the identifier of the global temporary table carried in the data operation request.

[0011] In an implementable manner, the coordination node creates the session temporary table in the target data node of the plurality of data nodes, comprising:

[0012] The coordination node generates and stores the table creation information corresponding to the session temporary table, and sends the table creation information corresponding to the session temporary table to the target data node.

[0013] In the scheme shown in the present application, when creating the session temporary table, the coordination node can send the table creation information corresponding to the session temporary table to the target data node, so that the target data node creates the table file corresponding to the session temporary table and binds the session temporary table with the global temporary table. The target data node can be any one or more data nodes in the platform.

[0014] In an implementable manner, the method further comprises: the target data node generates the table file and metadata corresponding to the session temporary table, and stores the metadata and the table creation information in the disk.

[0015] In the scheme shown in the application, after the target node receives the table building information corresponding to the session temporary table, the table file and the metadata corresponding to the session temporary table can be generated, and the metadata and the table building information are stored in the disk. Thus, the metadata corresponding to the session temporary table can be determined according to the session identifier and the global temporary table identifier, and then the table file corresponding to the session temporary table can be obtained according to the metadata, and data operation is performed on the table file. Since the metadata and the table file are stored in the disk, even if the data node restarts, data loss will not occur, and thus the stability of the distributed database can be improved.

[0016] In an implementable manner, after the data operation request is sent to the target data node, the method further includes:

[0017] The target data node receives the data operation request sent through the target session, and the data operation request carries the table identifier of the global temporary table. The target data node obtains the table structure of the global temporary table according to the table identifier. The target data node determines the target metadata in the disk according to the table identifier and the session identifier, wherein the table identifier and the session identifier are included in the table building information corresponding to the target metadata. The target data node finds the table file corresponding to the session temporary table according to the target metadata. The target data node performs data operation on the table file corresponding to the session temporary table according to the data operation request and the table structure.

[0018] In the embodiment of the application, the global temporary table can be bound with the session temporary table, and the data operation of the user end on the global temporary table can be converted into the data operation on the session temporary table. Since the table file and the metadata of the session temporary table can be stored in the disk, the restart of the data node will not cause the data loss of the session temporary table, and thus the related business of the global temporary table bound with the session temporary table can also be normally executed. Thus, the stability of the distributed database is improved, and the resource waste of the user end and the data node caused by the re-execution of the related business is avoided.

[0019] In an implementable manner, the method includes:

[0020] The coordination node cleans up the session temporary table after the target session ends.

[0021] In the scheme shown in the application, after the target session between the user end and the coordination node ends, the coordination node and the data node can clean up the established session temporary table. For example, the coordination node cleans up the table building information of the session temporary table. The data node cleans up the metadata, the table file, etc. corresponding to the session temporary table. Thus, the storage space of the coordination node and the data node occupied by the session temporary table can be avoided.

[0022] In a second aspect, a database operating system is provided. The system is configured on a cloud platform, and includes a coordination node and a plurality of data nodes. A database of the cloud platform is distributed in the plurality of data nodes. In the system:

[0023] The coordination node is configured to receive a data operation request sent by a user terminal through a target session. The data operation request is used for data operation on a global temporary table in the distributed database.

[0024] The coordination node is configured to determine whether a session temporary table corresponding to the global temporary table and belonging to the target session exists. Metadata corresponding to the session temporary table is stored in a disk of a data node.

[0025] In a case where it is determined that the session temporary table does not exist, the coordination node is configured to create the session temporary table in a target data node of the plurality of data nodes, and send the data operation request to the target data node.

[0026] In a case where it is determined that the session temporary table exists, the coordination node is configured to send the data operation request to the target data node. The data operation request is used to instruct the target data node to perform data operation on the session temporary table according to the target data node.

[0027] In an implementable manner, the coordination node is configured to determine whether table creation information of the session temporary table is stored locally. The table creation information includes a session identifier of the target session and a table identifier corresponding to the global temporary table.

[0028] In an implementable manner, the coordination node is configured to generate and store table creation information corresponding to the session temporary table, and send the table creation information corresponding to the session temporary table to the target data node.

[0029] The target data node is further configured to generate a table file and metadata corresponding to the session temporary table, and store the metadata and the table creation information in the disk.

[0030] In an implementable manner, the target data node is further configured to receive the data operation request sent through the target session. The data operation request carries the table identifier of the global temporary table.

[0031] The target data node is further configured to obtain a table structure of the global temporary table according to the table identifier.

[0032] The target data node is further configured to determine target metadata in the disk according to the table identifier and the session identifier. The table creation information corresponding to the target metadata includes the table identifier and the session identifier.

[0033] The target data node is further configured to find a table file corresponding to the session temporary table according to the target metadata.

[0034] The target data node is also configured to perform data operation on the table file corresponding to the session temporary table according to the data operation request and the table structure.

[0035] In an implementable manner, the coordination node is also configured to clean up the session temporary table after the target session ends.

[0036] In a third aspect, a computing device cluster is provided, including at least one computing device, each computing device including a processor and a memory, the processor of the at least one computing device being configured to execute instructions stored in the memory of the at least one computing device to cause the computing device cluster to perform the method provided in the first aspect.

[0037] In a fourth aspect, a computer program product including instructions is provided, and when the instructions are executed by a computing device cluster, the computing device cluster performs the method provided in the first aspect.

[0038] In a fifth aspect, a computer-readable storage medium including computer program instructions is provided, and when the computer program instructions are executed by a computing device cluster, the computing device cluster performs the method provided in the first aspect. BRIEF DESCRIPTION OF DRAWINGS

[0039] Figure 1 is a schematic diagram of a framework of a distributed database system;

[0040] Figure 2 is a flowchart of a database operation method provided by an embodiment of the present application;

[0041] Figure 3 is a flowchart of a database operation method provided by an embodiment of the present application;

[0042] Figure 4 is a schematic diagram of a database operation system architecture provided by an embodiment of the present application;

[0043] Figure 5 is a schematic diagram of a computer device structure provided by an embodiment of the present application;

[0044] Figure 6 is a schematic diagram of a computer device cluster structure provided by an embodiment of the present application;

[0045] Figure 7 is a schematic diagram of a computer device cluster structure provided by an embodiment of the present application. DETAILED DESCRIPTION

[0046] To make the objectives, technical solutions and advantages of the present application clearer, the embodiments of the present application will be further described in detail below with reference to the drawings.

[0047] The following explains the terms used in the embodiments of this application:

[0048] Temporary table: A table in a database used to store temporary or intermediate data.

[0049] Session temporary tables: A type of temporary table that belongs independently to a specific session. The table structure and data of a session temporary table are cleaned up after the session ends. Session temporary tables can include in-memory temporary tables and persistent temporary tables. In-memory temporary tables, the table structure and data are stored on disk, while metadata is stored in memory. Persistent temporary tables store the table structure, data, and metadata all on disk.

[0050] Global temporary table: A type of temporary table whose table structure and data are stored on disk and can be shared by multiple sessions. The metadata related to data operations performed on the global temporary table by each session is stored in memory.

[0051] Figure 1 This is a schematic diagram of a distributed database system framework. (Example) Figure 1 As shown, a distributed database system includes at least one coordinating node ( Figure 1 Only two instances are shown in the diagram, along with multiple data nodes. Data in a distributed database can be stored across different data nodes. Clients can establish sessions with the coordinating node and send data operation requests, such as data retrieval requests and data insertion requests, to the data nodes through the coordinating node.

[0052] In distributed database systems, the number of data nodes is large, and each data node has relatively low configuration. Compared to data nodes in a single-machine database system, each data node has a higher probability of experiencing anomalies. For global temporary tables in distributed databases, because the session-related metadata of the global temporary table is stored in memory, a restart of any data node due to an anomaly or other reason may lead to the loss of the global temporary table's metadata. This could render client-side business logic related to the global temporary table unavailable. The client can only detect the error and re-run the relevant business logic. This results in a waste of processing and storage resources for both the client and data nodes.

[0053] This application provides a database operation method that, by binding a global temporary table and a session temporary table, can solve the problem of easy data loss in the global temporary table, improve the stability of the distributed database system, and avoid the waste of processing and storage resources of the client and data nodes.

[0054] Figure 2 This is a flowchart of a database operation method provided in an embodiment of this application. See also... Figure 2 The method includes:

[0055] Step 201, the coordination node receives a data operation request sent by a user terminal through a target session, the data operation request being used for data operation on a global temporary table in a distributed database.

[0056] The coordination node can be any coordination node in a distributed storage system. A session (which can be referred to as a target session) can be established between the user terminal and the coordination node, and the user terminal sends a data operation request to the coordination node through the established target session. When the data operation request is used for data operation on the global temporary table, the data operation request can carry a table identifier corresponding to the global temporary table. For example, the data operation request can be a data insertion request, that is, data is inserted into the global temporary table, and the data operation request can be "insert into g1 values(1, 1)", where g1 is the table identifier corresponding to the global temporary table.

[0057] Before step 201 is performed, the client can send a table creation request of the global temporary table to the coordination node. After receiving the table creation request of the global temporary table, the coordination node can locally establish the global temporary table, and send metadata corresponding to the global temporary table, including a table name, a table identifier, a table structure, a schema, a file name, and the like, to each data node.

[0058] Step 202, the coordination node determines whether a session temporary table created for the global temporary table and belonging to the target session currently exists, wherein metadata of the session temporary table is stored in a disk of a data node.

[0059] In the embodiments of the present application, a session temporary table bound to the global temporary table can be created for each session, the created session temporary table has the same table structure as the global temporary table, and belongs to a persistent temporary table, that is, a table file and metadata corresponding to the session temporary table can be stored in a disk. In this way, data operation on the global temporary table can be converted to operation on the session temporary table. Since the table file and the metadata corresponding to the session temporary table can be persistently stored in the disk, even if the data node restarts, data loss will not occur, and therefore the stability of the distributed database can be improved.

[0060] In implementation, after receiving the data operation request for data operation on the global temporary table sent by the user terminal through the target session, the coordination node can first determine whether the coordination node has created a session temporary table belonging to the target session for the global temporary table.

[0061] In an implementable manner, after creating the session temporary table, the coordination node can locally store the table creation information corresponding to the session temporary table. For example, the table creation information can include the session identifier of the target session and the table identifier of the global temporary table. In this way, after receiving the data operation request for data operation on the global temporary table sent by the user end through the target session, the coordination node can locally store the table creation information to check whether the target table creation information corresponding to the session identifier of the target session and the table identifier of the global temporary table exists. If the target table creation information exists, it indicates that the coordination node has already established the session temporary table corresponding to the target session and the global temporary table. If the target table creation information does not exist, it indicates that the coordination node has not yet established the session temporary table corresponding to the target session and the global temporary table. The establishment process of the session temporary table will not be introduced here, and the details can be found in the content of step 203 below.

[0062] Step 203: In the case where it is determined that the session temporary table does not exist, the coordination node creates the session temporary table in the target data node of the plurality of data nodes, and sends the data operation request to the target data node.

[0063] If the coordination node determines that the session temporary table corresponding to the target session and the global temporary table has not been established, the coordination node can establish the session temporary table in the distributed database system. The coordination node can execute the session temporary table creation statement to generate the schema corresponding to the session temporary table. The schema corresponding to the session temporary table can include the session identifier of the target session. The coordination node can store the schema and the table identifier of the global temporary table as the table creation information of the session temporary table in the local storage.

[0064] The coordination node can also send a table creation notification to the target data node in the cloud platform. The table creation notification can carry the table creation information, such as the schema corresponding to the session temporary table and the table name (table identifier) of the global temporary table. The target data node can be any one of the plurality of data nodes in the cloud platform. The target data node receiving the table creation notification can create the table file corresponding to the session temporary table and generate the metadata corresponding to the table file. The table file and the corresponding metadata are stored in the disk of the data node, and the metadata corresponding to the table file can include the storage information of the table file in the disk. In an example, the data node can store the identifier of the global temporary table, the session identifier (such as the schema), and the metadata of the session temporary table as the creation record of the session temporary table in the disk.

[0065] After establishing the session temporary table in the distributed database, the coordination node can send the data operation request to the target data node. The target data node can perform corresponding processing after receiving the data operation request, which can be found in Figure 3 , including:

[0066] Step 2031, obtaining the table structure of the global temporary table according to the table identifier of the global temporary table.

[0067] In implementation, the table structure corresponding to the global temporary table, i.e., the table name of the global temporary table, the column name, and the data type corresponding to each column, etc., can be stored in each data node. The table structure corresponding to the global temporary table can be stored corresponding to the table identifier of the global temporary table, and the target data node can obtain the table structure of the global temporary table through the table identifier of the global temporary table.

[0068] Step 2032, determining the target metadata in the disk according to the table identifier of the global temporary table and the session identifier, wherein the table identifier of the global temporary table and the session identifier of the target session are included in the table creation information corresponding to the target metadata.

[0069] In the disk of the target data node, the creation record of the session temporary table is stored, including the identifier of the corresponding stored global temporary table, the session identifier (such as schema), and the metadata of the session temporary table, etc. After receiving the data operation request sent through the target session, the target data node can find the target metadata corresponding to the table identifier of the global temporary table and the session identifier of the target session carried in the data operation request in the creation record of the session temporary table. That is, the table identifier of the global temporary table and the session identifier of the target session are included in the table creation information corresponding to the target metadata.

[0070] Step 2033, finding the table file corresponding to the session temporary table according to the target metadata.

[0071] The storage information of the table file corresponding to the session temporary table is recorded in the target metadata. After obtaining the target metadata, the target data node can obtain the table file corresponding to the session temporary table according to the storage information recorded in the target metadata.

[0072] Step 2034, performing data operation on the table file corresponding to the session temporary table according to the data operation request and the table structure.

[0073] After obtaining the table file corresponding to the session temporary table, the target data node can perform data operation on the table file corresponding to the session temporary table according to the data operation request and the table structure corresponding to the global temporary table. In this way, the operation on the global temporary table can be changed to the operation on the session temporary table. For example, when the data operation request is a data insertion request, the data to be inserted can be inserted into the table file corresponding to the session temporary table according to the table structure corresponding to the global temporary table. For example, when the data operation request is a data reading request, the data to be read in the table file corresponding to the session temporary table can be obtained according to the table structure corresponding to the global temporary table, and the obtained data is returned to the client through the coordination node.

[0074] It can be seen that in the embodiment of the present application, the global temporary table can be bound with the session temporary table, and the data operation of the user end on the global temporary table can be converted into the data operation on the session temporary table. Since the table file and the metadata of the session temporary table can be stored in the disk, the restart of the data node will not cause the data loss of the session temporary table, and thus the related business of the global temporary table bound with the session temporary table can also be normally executed. In this way, the stability of the distributed database is improved, and the resource waste of the user end and the data node caused by the re-execution of the related business is avoided.

[0075] In step 204, when it is determined that the session temporary table exists, the coordination node sends a data operation request to the target data node, and the data operation request is used to instruct the target data node to perform the data operation on the session temporary table according to the target data node.

[0076] If the coordination node determines that the target session and the session temporary table corresponding to the global temporary table have been established, the coordination node sends a data operation request to the target data node, and the target data node performs the operations in steps 2031-2034, and thus the data operation on the session temporary table is completed.

[0077] In a possible case, when the coordination node sends the data operation request to the target data node, the coordination node can also send the identifier of the global temporary table, the session identifier and the like to the target data node. The target data node can search for the target metadata corresponding to the session temporary table in the creation record of the session temporary table stored in the disk according to the received identifier of the global temporary table, the session identifier and the like. If the target metadata is not found, it indicates that the target data node has not established the table file of the session temporary table, and thus the target data node can first establish the table file corresponding to the session temporary table and generate the corresponding target metadata. Then the target data node can store the identifier of the global temporary table, the session identifier and the metadata of the session temporary table and the like in the disk. Then the target data node can perform the operations in steps 2031-2034, and thus the data operation on the session temporary table is completed.

[0078] In another possible case, after the target session between the user end and the coordination node ends, the coordination node can clean up the established session temporary table. For example, the session data, the file name and the like of the session temporary table stored locally are deleted. The coordination node can also send the cleaning notification corresponding to the session temporary table to each data node. The identifier of the session temporary table and the like can be carried in the cleaning notification. After each data node receives the cleaning notification corresponding to the session temporary table, the metadata and the table file of the session temporary table stored locally can be cleaned up, so as to reduce the storage space occupied by the session temporary table.

[0079] It can be seen that in the embodiment of the application, a session temporary table bound to a global temporary table can be created for each session, and data operation on the global temporary table can be converted to operation on the session temporary table. Since the corresponding table data of the session temporary table can be persistently stored in the disk, the table data will not be lost even if the data node restarts, thereby improving the stability of the distributed database. The problem that all related businesses of the global temporary table need to be re-executed due to the data node restart can be solved, thereby reducing the waste of resources of the data node.

[0080] Figure 4 A database operating system provided by the embodiment of the application, the system is configured in a cloud platform, the system includes a coordination node 410 and a plurality of data nodes 420, and the database of the cloud platform is distributed in the plurality of data nodes, wherein:

[0081] The coordination node 410 is configured to receive a data operation request sent by a target session through a user end, and the data operation request is used for data operation on a global temporary table in a distributed database.

[0082] The coordination node 410 is configured to determine whether a session temporary table created for the global temporary table and belonging to the target session exists at present, wherein the corresponding metadata of the session temporary table is stored in the disk of the data node.

[0083] In a case where it is determined that the session temporary table does not exist, the coordination node 410 is configured to create the session temporary table in a target data node of the plurality of data nodes, and send the data operation request to the target data node.

[0084] In a case where it is determined that the session temporary table exists, the coordination node 410 is configured to send the data operation request to the target data node, and the data operation request is used for instructing the target data node 420 to perform data operation on the session temporary table according to the target data node.

[0085] In an implementable manner, the coordination node 410 is configured to determine whether the table creation information of the session temporary table is stored locally, and the table creation information includes the session identifier of the target session and the table identifier corresponding to the global temporary table.

[0086] In an implementable manner, the coordination node 410 is configured to generate and store the table creation information corresponding to the session temporary table, and send the table creation information corresponding to the session temporary table to the target data node.

[0087] The target data node 420 is further configured to generate the table file and the metadata corresponding to the session temporary table, and store the metadata and the table creation information in the disk.

[0088] In an implementable mode, the target data node 420 is further configured to receive a data operation request sent through the target session, the data operation request carrying a table identifier of the global temporary table;

[0089] The target data node 420 is further configured to obtain a table structure of the global temporary table according to the table identifier;

[0090] The target data node 420 is further configured to determine target metadata in the disk according to the table identifier and the session identifier, wherein the target metadata corresponds to table creation information including the table identifier and the session identifier;

[0091] The target data node 420 is further configured to find a table file corresponding to the session temporary table according to the target metadata;

[0092] The target data node 420 is further configured to perform data operation on the table file corresponding to the session temporary table according to the data operation request and the table structure.

[0093] In an implementable mode, the coordination node 410 is further configured to clean up the session temporary table after the target session ends.

[0094] The coordination node 410 and the data node 420 can be implemented by software or by hardware. For example, the implementation of the coordination node 410 is introduced as follows. Similarly, the implementation of the data node 420 can refer to the implementation of the coordination node 410.

[0095] As an example of a software functional unit, the coordination node 410 can include code running on a computing instance. The computing instance can be at least one of a physical host (computing device), a virtual machine, a container, and the like. Further, the computing device can be one or more. For example, the coordination node 410 can include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers used to run the application can be distributed in the same region, or can be distributed in different regions. The multiple hosts / virtual machines / containers used to run the code can be distributed in the same AZ, or can be distributed in different AZs, each AZ including a data center or multiple data centers with similar geographical locations. Generally, one region can include multiple AZs.

[0096] Likewise, the plurality of hosts / virtual machines / containers for running the code can be distributed in the same VPC or in multiple VPCs. Among them, usually one VPC is set in one region. The communication between two VPCs in the same region and the cross-region communication between VPCs in different regions need to set a communication gateway in each VPC to realize the interconnection between VPCs through the communication gateway.

[0097] As an example of the module as a hardware functional unit, the coordination node 410 can include at least one computing device such as a server or the like. Alternatively, the coordination node 410 can also be a device implemented by an ASIC or a PLD, etc. Among them, the PLD can be implemented by a CPLD, an FPGA, a GAL or any combination thereof.

[0098] The plurality of computing devices included in the coordination node 410 can be distributed in the same region or in different regions. The plurality of computing devices included in the coordination node 410 can be distributed in the same AZ or in different AZs. Likewise, the plurality of computing devices included in the coordination node 410 can be distributed in the same VPC or in multiple VPCs. Among them, the plurality of computing devices can be any combination of servers, ASICs, PLDs, CPLDs, FPGAs and GALs, etc.

[0099] The application also provides a computing device 100. As shown in Figure 5 The computing device 100 includes a bus 102, a processor 104, a memory 106 and a communication interface 108. The processor 104, the memory 106 and the communication interface 108 communicate through the bus 102. The computing device 100 can be a server or a terminal device. It should be understood that the number of processors and memories in the computing device 100 is not limited by the application.

[0100] The bus 102 can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 Only one line is used in the figure, but it does not mean that there is only one bus or one type of bus. The bus 102 can include a path for transmitting information between various components (e.g., the memory 106, the processor 104, the communication interface 108) of the computing device 100.

[0101] The processor 104 may include any one or more processors such as a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).

[0102] Memory 106 may include volatile memory, such as random access memory (RAM). Memory 106 may also include non-volatile memory, such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid state drive (SSD).

[0103] The memory 106 stores executable code, which the processor 104 executes to implement the functions of the aforementioned coordination node 410 and data node 420, thereby realizing the database operation method. That is, the memory 106 stores instructions for executing the database operation method.

[0104] The communication interface 108 uses transceiver modules such as, but not limited to, network interface cards and transceivers to enable communication between the computing device 100 and other devices or communication networks.

[0105] This application also provides a computing device cluster. The computing device cluster includes at least one computing device. The computing device can be a server, such as a central server, an edge server, or a local server in a local data center. In some embodiments, the computing device can also be a terminal device such as a desktop computer, a laptop computer, or a smartphone.

[0106] like Figure 6 As shown, the computing device cluster includes at least one computing device 100. The memory 106 of one or more computing devices 100 in the computing device cluster may store the same instructions for performing database operation methods.

[0107] In some possible implementations, the memory 106 of one or more computing devices 100 in the computing device cluster may also store partial instructions for executing database operation methods. In other words, a combination of one or more computing devices 100 can jointly execute instructions for performing database operation methods.

[0108] It should be noted that the memory 106 in different computing devices 100 in the computing device cluster can store different instructions, which are used to execute some functions of the coordinating node 410 respectively.

[0109] In some possible implementations, the memory 106 of one or more computing devices 100 in the computing device cluster may also store partial instructions for executing database operation methods. In other words, a combination of one or more computing devices 100 can jointly execute instructions for performing database operation methods.

[0110] In some possible implementations, one or more computing devices in a computing device cluster can be connected via a network. This network can be a wide area network (WAN) or a local area network (LAN), etc. Figure 7 One possible implementation is shown. For example... Figure 7 As shown, two computing devices 100A and 100B are connected via a network. Specifically, they are connected to the network through communication interfaces in each computing device. In this possible implementation, the memory 106 in computing device 100A stores instructions for executing the functions of module A. Meanwhile, the memory 106 in computing device 100B stores instructions for executing the functions of modules B and C.

[0111] Figure 7 The connection method between the computing device clusters shown can be such that, considering the database operation method provided in this application requires a large amount of data storage, the functions implemented by the data node 420 are delegated to the computing device 100B.

[0112] It should be understood that Figure 7 The functions of the computing device 100A shown can also be performed by multiple computing devices 100. Similarly, the functions of the computing device 100B can also be performed by multiple computing devices 100.

[0113] This application also provides another computing device cluster. The connection relationships between the computing devices in this computing device cluster can be similarly referred to... Figure 6 and Figure 7 The connection method of the computing device cluster is different in that the memory 106 of one or more computing devices 100 in the computing device cluster can store the same instructions for executing database operation methods.

[0114] In some possible implementations, the memory 106 of one or more computing devices 100 in the computing device cluster may also store partial instructions for executing database operation methods. In other words, a combination of one or more computing devices 100 can jointly execute instructions for performing database operation methods.

[0115] It should be noted that the memory 106 in different computing devices 100 in the computing device cluster can store different instructions for performing part of the functions of the automated testing system. That is, the memory 106 in different computing devices 100 stores instructions that can implement the functions of one or more of the coordination node 410 and the data node 420.

[0116] The embodiments of the present application also provide a computer program product containing instructions. The computer program product can be a software or program product containing instructions, which can be run on a computing device or stored in any available medium. When the computer program product is run on at least one computing device, the at least one computing device is caused to perform the database operation method, or the database operation method.

[0117] The embodiments of the present application also provide a computer readable storage medium. The computer readable storage medium can be any available medium that the computing device can store or a data storage device such as a data center containing one or more available media. The available medium can be a magnetic medium (for example, a floppy disk, a hard disk, a magnetic tape), an optical medium (for example, a DVD), or a semiconductor medium (for example, a solid state disk), etc. The computer readable storage medium contains instructions, which instruct the computing device to perform the database operation method, or instruct the computing device to perform the database operation method.

[0118] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand: they can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for part of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the protection scope of the technical solutions of the embodiments of the present application.

Claims

1. A database operation method, characterized in that, The method is applied to a cloud platform, which includes a coordinating node and multiple data nodes, and the database of the cloud platform is distributed across the multiple data nodes. The method includes: The coordinating node receives a data operation request sent by the user terminal through the target session. The data operation request is used to perform data operations on the global temporary table in the distributed database. The coordinating node determines whether there is a session temporary table that was created for the global temporary table and belongs to the target session, wherein the metadata corresponding to the session temporary table is stored in the disk of the data node; If it is determined that the session temporary table does not exist, the coordinating node creates the session temporary table in the target data node among the plurality of data nodes and sends the data operation request to the target data node; If the existence of the session temporary table is confirmed, the coordinating node sends the data operation request to the target data node, the data operation request being used to instruct the target data node to perform data operations on the session temporary table according to the target data node.

2. The method according to claim 1, characterized in that, The coordinating node determines whether a session temporary table belonging to the target session exists that was created for the global temporary table, including: The coordinating node determines whether the table creation information of the session temporary table is stored locally. The table creation information includes the session identifier of the target session and the table identifier corresponding to the global temporary table.

3. The method according to claim 2, characterized in that, The coordinating node creates the session temporary table in the target data node among the multiple data nodes, including: The coordinating node generates and stores the table creation information corresponding to the session temporary table, and sends the table creation information corresponding to the session temporary table to the target data node. The method further includes: The target data node generates the table file and metadata corresponding to the session temporary table, and stores the metadata and table creation information on the disk.

4. The method according to claim 3, characterized in that, After sending the data operation request to the target data node, the method further includes: The target data node receives the data operation request sent through the target session, and the data operation request carries the table identifier of the global temporary table. The target data node obtains the table structure of the global temporary table based on the table identifier; The target data node determines the target metadata in the disk based on the table identifier and the session identifier, wherein the table creation information corresponding to the target metadata includes the table identifier and the session identifier; The target data node searches for the table file corresponding to the session temporary table based on the target metadata; The target data node performs data operations on the table file corresponding to the session temporary table according to the data operation request and the table structure.

5. The method according to any one of claims 1 to 4, characterized in that, The method includes: The coordinating node cleans up the session temporary table after the target session ends.

6. A database operating system, characterized in that, The system is configured on a cloud platform and includes a coordination node and multiple data nodes. The cloud platform's database is distributed across the multiple data nodes, wherein: The coordination node is used to receive data operation requests sent by the user terminal through the target session. The data operation requests are used to perform data operations on the global temporary table in the distributed database. The coordination node is used to determine whether there is a session temporary table that was created for the global temporary table and belongs to the target session, wherein the metadata corresponding to the session temporary table is stored in the disk of the data node; If it is determined that the session temporary table does not exist, the coordinating node is used to create the session temporary table in the target data node among the plurality of data nodes and send the data operation request to the target data node; If the existence of the session temporary table is determined, the coordinating node is used to send the data operation request to the target data node, the data operation request being used to instruct the target data node to perform data operations on the session temporary table according to the target data node.

7. The system according to claim 6, characterized in that, The coordination node is used to determine whether the table creation information of the session temporary table is stored locally. The table creation information includes the session identifier of the target session and the table identifier corresponding to the global temporary table.

8. The system according to claim 7, characterized in that, The coordination node is used to generate and store the table creation information corresponding to the session temporary table, and send the table creation information corresponding to the session temporary table to the target data node; The target data node is also used to generate the table file and metadata corresponding to the session temporary table, and to store the metadata and the table creation information on the disk.

9. The system according to claim 8, characterized in that, The target data node is also configured to receive the data operation request sent through the target session, the data operation request carrying the table identifier of the global temporary table; The target data node is also used to obtain the table structure of the global temporary table based on the table identifier; The target data node is further configured to determine target metadata in the disk based on the table identifier and the session identifier, wherein the table creation information corresponding to the target metadata includes the table identifier and the session identifier; The target data node is also used to locate the table file corresponding to the session temporary table based on the target metadata; The target data node is also used to perform data operations on the table file corresponding to the session temporary table according to the data operation request and the table structure.

10. The system according to any one of claims 6 to 9, characterized in that, The coordination node is also used to clean up the session temporary table after the target session ends.

11. A computing device cluster, characterized in that, It includes at least one computing device, each computing device including a processor and memory; The processor of the at least one computing device is configured to execute instructions stored in the memory of the at least one computing device to cause the cluster of computing devices to perform the method as described in any one of claims 1 to 5.

12. A computer program product containing instructions, characterized in that, When the instruction is executed by the computing device cluster, the computing device cluster causes the computing device cluster to perform the method as described in any one of claims 1 to 5.

13. A computer-readable storage medium, characterized in that, Includes computer program instructions, which, when executed by a cluster of computing devices, perform the method as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Method and apparatus for optimizing inquiry aiming at vertical storage type database

    CN101436192A

  • Real-time database for rail transit, operating method and operating device

    CN102110134A