Data scheduling method and device for distributed database and storage medium
By receiving data distribution strategy binding instructions in the distributed database, non-partitioned tables and partitioned tables are bound to the same data distribution strategy, enabling data to be stored on the same node. This solves the problem in existing technologies where non-partitioned tables and partitioned tables cannot be migrated to the same node, improving data retrieval efficiency and user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- TENCENT TECHNOLOGY (SHENZHEN) CO LTD
- Filing Date
- 2024-02-07
- Publication Date
- 2026-07-03
AI Technical Summary
Existing share-nothing distributed database architectures cannot migrate non-partitioned and partitioned tables to the same node, resulting in low data retrieval efficiency and a poor user experience.
By receiving the data distribution strategy binding instruction, the first data table is bound to the first data distribution strategy, and the data of the first data table and the second data table are scheduled according to the strategy so that they are stored on the same database node, thereby realizing the storage of data of non-partitioned tables and partitioned tables on the same node.
It reduces distributed transaction compensation, improves data retrieval performance and user experience, and ensures the stability of data retrieval when the node cluster changes.
Smart Images

Figure CN118035352B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and in particular to a data scheduling method, apparatus and storage medium for distributed databases. Background Technology
[0002] In related technologies, distributed databases have the ability to store both non-partitioned and partitioned tables. Based on this, large amounts of data in the master table can be broken down and stored on various distributed database nodes through partitioned tables. When making general data calls, data in the partitioned tables can be retrieved from various distributed database nodes, or data in the non-partitioned tables stored on a distributed database node can be retrieved.
[0003] Currently, the most commonly used database architecture is the share-nothing architecture. While share-nothing databases can store both partitioned and non-partitioned tables, they lack the ability to migrate both to the same node. For example, suppose a non-partitioned table and one or more partitions of a partitioned table happen to be located on the same database node. However, if the non-partitioned table is migrated to another database node, and it is necessary to store one or more partitions of the partitioned table and the non-partitioned table on the same database node, these share-nothing database technologies cannot meet this requirement. Summary of the Invention
[0004] The following is an overview of the subject matter described in detail herein. This overview is not intended to limit the scope of the claims.
[0005] This application provides a data scheduling method, apparatus, and storage medium for distributed databases, which can migrate partitions and non-partitioned tables of a partitioned table to the same database node.
[0006] On one hand, embodiments of this application provide a data scheduling method for a distributed database, comprising the following steps:
[0007] Receive a data distribution strategy binding instruction, wherein the data distribution strategy binding instruction specifies a first data distribution strategy for a first data table, and the first data distribution strategy is bound to a second data table;
[0008] According to the data distribution strategy binding instruction, the first data table is bound to the first data distribution strategy;
[0009] According to the first data distribution strategy, the data in the first data table and the data in the second data table are scheduled so that the data in the first data table and the data in the second data table are stored in the same database node.
[0010] On the other hand, embodiments of this application also provide a data scheduling apparatus for a distributed database, comprising:
[0011] A binding instruction receiving unit is used to receive a data distribution strategy binding instruction, wherein the data distribution strategy binding instruction specifies a first data distribution strategy for a first data table, and the first data distribution strategy is bound to a second data table;
[0012] The strategy binding unit is used to bind the first data table to the first data distribution strategy according to the data distribution strategy binding instruction;
[0013] The data scheduling unit is used to schedule the data of the first data table and the data of the second data table according to the first data distribution strategy, so that the data of the first data table and the data of the second data table are stored in the same database node.
[0014] Optionally, the policy binding unit is further configured to:
[0015] According to the data distribution strategy binding instruction, the first data table is associated with the second data table, and the first data table is bound to the first data distribution strategy.
[0016] Optionally, the data scheduling device for distributed databases further includes:
[0017] The first strategy lookup unit is used to look up the first data distribution strategy in the storage layer according to the data distribution strategy binding instruction.
[0018] The first data table acquisition unit is used to acquire the second data table bound to the first data distribution strategy in the storage layer when the first data distribution strategy is found.
[0019] Optionally, the data scheduling device for distributed databases further includes:
[0020] An update instruction receiving unit is used to receive a strategy binding update instruction, wherein the strategy binding update instruction specifies a second data distribution strategy for the first data table, and the second data distribution strategy is bound to a third data table;
[0021] The binding update unit is used to update the binding between the first data table and the first data distribution strategy to the binding between the first data table and the second data distribution strategy according to the strategy binding update instruction.
[0022] The data rescheduling unit is used to schedule the data of the first data table and the data of the third data table according to the second data distribution strategy, so that the data of the first data table and the data of the third data table are stored in the same database node.
[0023] Optionally, the binding update unit is further configured to:
[0024] According to the strategy binding update instruction, the binding between the first data table and the first data distribution strategy is released;
[0025] Bind the first data table to the second data distribution strategy.
[0026] Optionally, the binding update unit is further configured to:
[0027] Associate the first data table with the third data table, and bind the first data table with the second data distribution strategy.
[0028] Optionally, the data scheduling device for distributed databases further includes:
[0029] The second strategy lookup unit is used to look up the second data distribution strategy in the storage layer according to the strategy binding update instruction;
[0030] The second data table acquisition unit is used to acquire the third data table bound to the second data distribution strategy in the storage layer when the second data distribution strategy is found.
[0031] Optionally, the data scheduling device for distributed databases further includes:
[0032] A change instruction receiving unit is configured to receive a data distribution strategy change instruction, wherein the data distribution strategy change instruction includes the target data distribution strategy to be changed;
[0033] The binding judgment unit is used to perform data table binding judgment on the target data distribution strategy according to the data distribution strategy change instruction;
[0034] The strategy unbinding unit is used to unbind the target data distribution strategy from the fourth data table when it is determined that the target data distribution strategy is bound to the fourth data table.
[0035] The strategy change unit is used to change the target data distribution strategy.
[0036] Optionally, the binding determination unit is further configured to:
[0037] According to the data distribution strategy change instruction, the target data distribution strategy is located in the storage layer;
[0038] Once the target data distribution strategy is found, the metadata of the target data distribution strategy is obtained from the storage layer;
[0039] The target data distribution strategy is determined by binding data tables based on the metadata.
[0040] Optionally, the data scheduling device for distributed databases further includes a strategy creation unit, which is used for:
[0041] Receive data distribution strategy creation instructions;
[0042] The first data distribution strategy is created according to the data distribution strategy creation instruction;
[0043] Perform a legality check on the first data distribution strategy;
[0044] Once the validity of the first data distribution strategy is determined to be valid, the first data distribution strategy is saved to the storage layer.
[0045] Optionally, the first data distribution strategy includes strategy identification information, and the strategy creation unit is further configured to:
[0046] The policy identification information is located in the storage layer;
[0047] If the strategy identifier information is not found, the first data distribution strategy is deemed to be legal.
[0048] On the other hand, embodiments of this application also provide an electronic device, including:
[0049] At least one processor;
[0050] At least one memory for storing at least one program;
[0051] When at least one of the programs is executed by at least one of the processors, the data scheduling method for distributed databases as described above is implemented.
[0052] On the other hand, embodiments of this application also provide a computer-readable storage medium storing a processor-executable computer program, which, when executed by a processor, is used to implement the data scheduling method for a distributed database as described above.
[0053] On the other hand, embodiments of this application also provide a computer program product, including a computer program or computer instructions, the computer program or computer instructions being stored in a computer-readable storage medium, a processor of an electronic device reading the computer program or computer instructions from the computer-readable storage medium, and the processor executing the computer program or computer instructions to cause the electronic device to perform the data scheduling method for a distributed database as described above.
[0054] The embodiments of this application include at least the following beneficial effects: First, a data distribution strategy binding instruction specifying a first data distribution strategy for a first data table is received, wherein the first data distribution strategy is bound to a second data table. Then, according to the data distribution strategy binding instruction, the first data table is bound to the first data distribution strategy. Next, according to the first data distribution strategy, the data of the first data table and the data of the second data table are scheduled so that the data of the first data table and the data of the second data table are stored on the same database node. Since the data of the first data table and the data of the second data table can be stored on the same database node because the first data table and the second data table are both bound to the same first data distribution strategy, even if the first data table is a non-partitioned table and the second data table is a partition of a partitioned table, it is not necessary to consider the partition nature of the first data table and the second data table and directly bind the first data table and the second data table to the same first data distribution strategy. This allows the data of the first data table and the data of the second data table to be scheduled and stored on the same database node, thereby reducing distributed transaction compensation and improving the data retrieval performance of the distributed database.
[0055] Other features and advantages of this application will be set forth in the following description and will be apparent in part from the description or may be learned by practicing the application. The objectives and other advantages of this application may be realized and obtained by means of the structures particularly pointed out in the description and the accompanying drawings. Attached Figure Description
[0056] The accompanying drawings are used to provide a further understanding of the technical solutions of this application and constitute a part of the specification. They are used together with the embodiments of this application to explain the technical solutions of this application and do not constitute a limitation on the technical solutions of this application.
[0057] Figure 1 This is a schematic diagram of an implementation environment provided in an embodiment of this application;
[0058] Figure 2 This is a schematic diagram of another implementation environment provided in the embodiments of this application;
[0059] Figure 3This is a flowchart of a data scheduling method for a distributed database provided in an embodiment of this application;
[0060] Figure 4 This is a schematic diagram of the data scheduling process related to the association between the first data table and the second data table, provided as a specific example of this application;
[0061] Figure 5 This is another specific example of the data scheduling process diagram provided in this application regarding the association between the first data table and the second data table;
[0062] Figure 6 This is a schematic diagram of the data scheduling process for creating a first data distribution strategy, provided as a specific example of this application.
[0063] Figure 7 This is a schematic diagram of the data scheduling process for checking the legality of the first data distribution strategy, provided as a specific example of this application.
[0064] Figure 8 This is another specific example of the data scheduling process diagram for the first data distribution strategy legality check provided in this application;
[0065] Figure 9 This is a data scheduling diagram provided as a specific example of the present application regarding the uniqueness check of the binding of the first data table;
[0066] Figure 10 This is another specific example of the data scheduling diagram provided in this application regarding the uniqueness check of the binding of the first data table;
[0067] Figure 11 This is another specific example of the data scheduling diagram provided in this application regarding the uniqueness check of the binding of the first data table;
[0068] Figure 12 This is another specific example of the data scheduling diagram provided in this application regarding the uniqueness check of the binding of the first data table;
[0069] Figure 13 This is a database query performance comparison chart provided in an embodiment of this application;
[0070] Figure 14 This is a schematic diagram of the data scheduling process related to the association between the first data table and the third data table, provided as a specific example of this application;
[0071] Figure 15 This is a schematic diagram of a data scheduling process for associating a first data table with a third data table, provided in another embodiment of this application;
[0072] Figure 16This is a schematic diagram of the data scheduling process for checking the legality of a third data distribution strategy, provided as a specific example in this application.
[0073] Figure 17 This is another specific example of a data scheduling process diagram provided in this application regarding the legality check of a third data distribution strategy;
[0074] Figure 18 This is a schematic diagram illustrating the data distribution strategy change process, provided as a specific example in this application.
[0075] Figure 19 This is another specific example of a data distribution strategy change process provided in this application;
[0076] Figure 20 This is a detailed flowchart of a data scheduling method for a distributed database provided in a specific embodiment of this application;
[0077] Figure 21 This is a schematic diagram of the structure of a data scheduling device for a distributed database provided in an embodiment of this application;
[0078] Figure 22 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0079] The present application will be further described below with reference to the accompanying drawings and specific embodiments. The described embodiments should not be considered as limitations on the present application, and all other embodiments obtained by those skilled in the art without inventive effort are within the scope of protection of the present application.
[0080] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0081] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.
[0082] Before providing a further detailed description of the embodiments of this application, the nouns and terms involved in the embodiments of this application will be explained, and the nouns and terms involved in the embodiments of this application shall be interpreted as follows.
[0083] 1) Model parallel computing refers to distributing the computational tasks of a model to multiple computing devices (such as Central Processing Units (CPUs), Graphics Processing Units (GPUs), Tensor Processing Units (TPUs), etc.) for simultaneous computation, thereby accelerating model training and inference. Model parallel computing can effectively utilize computing resources and improve the computational efficiency and training speed of the model.
[0084] 2) Intelligent Traffic System (ITS), also known as Intelligent Transportation System, effectively integrates advanced science and technology (information technology, computer technology, data communication technology, sensor technology, electronic control technology, automatic control theory, operations research, artificial intelligence, etc.) into transportation, service control, and vehicle manufacturing, strengthening the connection between vehicles, roads, and users, thereby forming a comprehensive transportation system that ensures safety, improves efficiency, improves the environment, and saves energy.
[0085] 3) Artificial Intelligence (AI) is the theory, methods, technology, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results. In other words, AI is a comprehensive technology within computer science that attempts to understand the essence of intelligence and produce a new kind of intelligent machine that can react in a way similar to human intelligence. AI studies the design principles and implementation methods of various intelligent machines, enabling them to have perception, reasoning, and decision-making capabilities. AI technology is a comprehensive discipline involving a wide range of fields, encompassing both hardware and software technologies. Fundamental AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing technology, pre-trained model technology, operating / interactive systems, and mechatronics. Pre-trained models, also known as large models or foundational models, can be widely applied to downstream tasks in various AI directions after fine-tuning. AI software technologies mainly include computer vision technology, speech processing technology, natural language processing technology, and machine learning / deep learning.
[0086] 4) Artificial intelligence cloud services, also commonly known as AIaaS (AI as a Service), are a mainstream service model for artificial intelligence platforms. Specifically, AIaaS platforms break down several common AI services and provide them as independent or packaged services in the cloud. This service model is similar to opening an AI-themed marketplace: all developers can access and use one or more AI services provided by the platform through API interfaces. Some experienced developers can also use the AI framework and AI infrastructure provided by the platform to deploy and maintain their own dedicated cloud AI services.
[0087] 5) Cloud Social is a virtual social application model that integrates the Internet of Things, cloud computing, and mobile internet. Its purpose is to establish a well-known "resource-sharing relationship graph" to facilitate online social interaction. The main characteristic of Cloud Social is the unified integration and evaluation of a large amount of social resources, forming an effective resource pool to provide services to users on demand. The more users participate in sharing, the greater the value created.
[0088] 6) Public cloud typically refers to a cloud provided by a third-party provider to users. Public clouds are generally accessible via the Internet and may be free or inexpensive. The core attribute of a public cloud is shared resource service. There are many instances of this type of cloud, providing services across today's entire open public network.
[0089] Currently, distributed databases can include distributed databases with a shared-nothing architecture and distributed databases with a shared-storage architecture. Of the two, the shared-nothing architecture is more commonly used. While shared-nothing databases can store both partitioned and non-partitioned tables, they lack the ability to migrate both to the same node. For example, suppose a non-partitioned table and one or more partitions of a partitioned table happen to reside on the same database node. However, if the non-partitioned table is migrated to another database node, and it is then necessary to store one or more partitions of the partitioned table and the non-partitioned table on the same database node, the shared-nothing architecture cannot fulfill this requirement.
[0090] For shared-nothing distributed databases, this type of architecture provides a mechanism for adjusting the data distribution of partitioned tables. For example, in related technologies, one or more partitions of a partitioned table can be bound together using a grouping strategy, or a non-partitioned table can be bound together using a grouping strategy, thereby adjusting the data distribution of the data tables bound by the grouping strategy. However, this type of distributed database architecture cannot bind one or more partitions of a non-partitioned table and a partitioned table to the same grouping strategy. This makes it difficult to simultaneously adjust the data distribution of non-partitioned tables and one or more partitions of a partitioned table that have close business relationships. Furthermore, due to the limitations of grouping strategy usage, when the distributed database system undergoes cluster expansion or contraction, it is necessary to change the grouping strategy and the structure of all data tables bound to it. Otherwise, the newly added database nodes may not be usable or data may be lost. This change process is strongly perceived by users and will affect the user experience.
[0091] For distributed databases with a shared-storage architecture, this type of distributed database does not provide a mechanism to adjust the data distribution. Even the lowest-level commands or scripts cannot achieve this, and it is impossible to adjust the distribution of two data tables to the same database node. Therefore, distributed transaction compensation cannot be eliminated.
[0092] To reduce distributed transaction compensation caused by cross-node data calls, embodiments of this application provide a data scheduling method, apparatus, storage medium, and computer program product for distributed databases. First, a data distribution strategy binding instruction is received, specifying a first data distribution strategy for a first data table, wherein the first data distribution strategy is bound to a second data table. Then, according to the data distribution strategy binding instruction, the first data table is bound to the first data distribution strategy. Next, according to the first data distribution strategy, the data of the first data table and the data of the second data table are scheduled, so that the data of the first data table and the data of the second data table are stored on the same node. This is because the data of the first data table and the data of the second data table are both bound to the same first data distribution strategy. Because the first data table is a non-partitioned table and the second data table is a partition of a partitioned table, the partitioning properties of the first and second data tables can be considered, and both tables can be directly bound to the same first data distribution strategy. This allows the data from both tables to be scheduled and stored on the same node, reducing distributed transaction compensation and improving the data retrieval performance of the distributed database. Furthermore, since both the scheduled data and the data originally stored on the node can be accessed locally, changes in the node cluster will not affect the local access to data on that node, ensuring the stability of data retrieval and improving the user experience.
[0093] Figure 1 This is a schematic diagram of an implementation environment provided in an embodiment of this application. (Refer to...) Figure 1 The implementation environment is a shared-storage distributed scenario, which includes a distributed database system, a first user terminal 102, and a first scheduling terminal 103. The distributed database system includes multiple first database nodes 101, and the storage layer corresponding to each first database node 101 is the shared storage layer in the shared-storage distributed database system. The first database nodes 101 communicate directly or indirectly with each other. The first database nodes 101 can be nodes in a blockchain, but this embodiment does not specifically limit this.
[0094] The first database node 101 can be set up in an independent physical server, or it can be located in a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms.
[0095] The first user terminal 102 and the first dispatch terminal 103 may be, but are not limited to, smart devices such as smartphones, computers, smart voice interaction devices, smart home appliances, vehicle terminals, and aircraft. Optionally, the first dispatch terminal 103 may be equipped with a business data processing client, which sends control commands to at least one of the multiple first databases 101 to cause the corresponding first database node 101 to perform corresponding actions.
[0096] In one embodiment, at least one of the plurality of first database nodes 101 has functions such as receiving policy instructions, binding data distribution policies, and data scheduling. Taking the first database 101 as an example, the first database 101 stores a first data table and a second data table. The first database 101 can receive a data distribution policy binding instruction, wherein the data distribution policy binding instruction specifies a first data distribution policy for the first data table, and the first data distribution policy is bound to the second data table; then, according to the data distribution policy binding instruction, the first data table is bound to the first data distribution policy; then, according to the first data distribution policy, the data of the first data table and the data of the second data table are scheduled, so that the data of the first data table and the data of the second data table are stored in the same database node. At this time, when the first user terminal 103 needs to call the data of the first data table, the second data table, and the original data of the database node at the same time, it can directly call the required data in the same database node without calling across database nodes.
[0097] Reference Figure 1As shown, in one application scenario, a shared storage layer stores created data distribution strategies. Each first database node 101, upon receiving a specific instruction, can invoke the created data distribution strategy from the shared storage layer. Assuming that the first database node 101, acting as the first node, stores a first data table and a second data table, the first data table is not bound to a data distribution strategy before the first user terminal 103 invokes the data. However, the data stored in the two data tables is closely related to the data in the first database node 101, acting as the second node, at the business level. The first scheduling terminal 103 can send a data distribution strategy binding instruction to the first node. After receiving the data distribution strategy binding instruction, the first node can invoke the created data distribution strategy according to the instruction and schedule the data in the data table bound to the data distribution strategy. The data distribution strategy binding instruction sent by the first scheduling terminal 103 specifies a first data distribution strategy for the first data table. This first data distribution strategy is bound to a second data table. In this application scenario, assuming the data of the data table specified by the first data distribution strategy needs to be scheduled to the second node, and the scheduling layer of the first node has not yet scheduled the data of the second data table, the first node can first obtain the first data distribution strategy from the storage layer according to the data distribution strategy binding instruction. Then, at the computing layer, it binds the first data table to the first data distribution strategy pre-bound to the second data table. Next, according to the first data distribution strategy, it schedules the data of the first and second data tables to the second node, allowing the data of both tables to be stored simultaneously on the second node. The associated first data table is then persisted to the data dictionary of the storage layer. After data scheduling is completed, the first user terminal 102 can send a data retrieval request to the second node to retrieve the scheduled data and the original data stored on the second node, thereby reducing distributed transaction compensation caused by cross-node calls.
[0098] Figure 2 This is a schematic diagram of another implementation environment provided in the embodiments of this application. (Refer to...) Figure 2This scenario includes a distributed database system, a second user terminal 202, and a second scheduling terminal 203. The distributed database system includes multiple second database nodes 201 and multiple data distribution strategy storage devices 204. Each second database node 201 corresponds to one of the multiple data distribution strategy storage devices 204. Each second database node 201 obtains data distribution strategy storage from its corresponding data distribution strategy storage device 204. The storage layer corresponding to each second database node 201 is the shared storage layer in the shared-storage distributed database system. The second database nodes 201 communicate directly or indirectly with each other. The multiple second database nodes 201 and the multiple data distribution strategy storage devices 204 can be nodes in a blockchain; this embodiment does not specifically limit this.
[0099] The second database node 201 can be set up in an independent physical server, or in a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms.
[0100] The second user terminal 202 and the second dispatch terminal 203 may include, but are not limited to, smart devices such as smartphones, computers, smart voice interaction devices, smart home appliances, vehicle terminals, and aircraft. Optionally, the second dispatch terminal 203 may be equipped with a business data processing client, which sends control commands to at least one of the multiple first databases 101 to cause the corresponding second database node 201 to perform corresponding actions.
[0101] The data distribution strategy storage device 204 can be located outside the corresponding second database node 201 and connected to the corresponding second database node 201, or it can be integrated on the second database node 201 or integrated on other devices.
[0102] In one embodiment, at least one of the plurality of second database nodes 201 has functions such as receiving policy instructions, obtaining data distribution policies from the corresponding data distribution policy storage device 204, binding data distribution policies, and data scheduling. One of the plurality of second database nodes 201 stores a first data table and a second data table. The first database 101 can receive a data distribution policy binding instruction, wherein the data distribution policy binding instruction specifies a first data distribution policy for the first data table, and the first data distribution policy is bound to the second data table. Then, according to the data distribution policy binding instruction, the first data table is bound to the first data distribution policy. Then, according to the first data distribution policy, the data of the first data table and the data of the second data table are scheduled, so that the data of the first data table and the data of the second data table are stored on the same node. At this time, when the second user terminals 202 can all access the data in the first data table, the data in the second data table, and the original data locally on the same second database node 201, cross-node access is not required.
[0103] Reference Figure 2As shown, in one application scenario, each data distribution strategy storage device 204 is located outside and connected to the corresponding second database node 201. Assuming the second database node 201, acting as the first node, stores a first data table and a second data table, before the first user terminal 103 calls the data, the first data table is not bound to a data distribution strategy. However, the data stored in the two data tables is closely related to the data in the second database node 201 at the business level. The second scheduling terminal 203 can send a data distribution strategy binding instruction to the first node. After receiving the instruction, the first node can invoke the created data distribution strategy according to the instruction to schedule the data in the bound data table. The data distribution strategy binding instruction sent by the second scheduling terminal 203 specifies a first data distribution strategy for the first data table. This first data distribution strategy is bound to a second data table. In this application scenario, assuming the data in the data table specified by the first data distribution strategy needs to be scheduled to the second node, and the scheduling layer of the first node has not yet scheduled the data in the second data table, the first node can first retrieve the first data distribution strategy from the corresponding data distribution strategy storage device 204 according to the data distribution strategy binding instruction. Then, in its local computing layer, the first node binds the first data table to the first data distribution strategy pre-bound to the second data table. Then, according to the first data distribution strategy, it schedules the data in the first and second data tables to the second node, allowing the data in both tables to be stored simultaneously on the second node. After data scheduling is completed, the second user terminal 202 can send a data retrieval request to the second node to retrieve the scheduled data and the original data stored on the second node, thereby reducing distributed transaction compensation caused by cross-node calls.
[0104] Based on the aforementioned implementation scenarios, this application can be applied to multiple data retrieval scenarios, such as vehicle-to-everything (V2X) scenarios involving model-to-computer computation and intelligent transportation systems, or cloud application scenarios such as artificial intelligence cloud services, cloud social networking, and public cloud. For these scenarios, this application, through a data scheduling method for distributed databases, can schedule closely related business-level data to the same database node. When retrieving closely related business-level data, the relevant devices only need to directly retrieve the data from the database node storing it, instead of retrieving partial data from multiple database nodes one by one, thus improving data retrieval efficiency and enhancing user experience.
[0105] It should be noted that in various specific embodiments of this application, when processing data related to the characteristics of the target object (e.g., a user's attribute information or a set of attribute information) is required, the target object's permission or consent will be obtained first. Furthermore, the collection, use, and processing of this data will comply with relevant laws, regulations, and standards. In addition, when embodiments of this application need to obtain the target object's attribute information, separate permission or consent from the target object will be obtained through pop-ups or redirection to a confirmation page. Only after obtaining the target object's separate permission or consent will the necessary target object-related data for the normal operation of the embodiments of this application be obtained.
[0106] Figure 3 This is a flowchart illustrating a data scheduling method for a distributed database provided in an embodiment of this application. This data scheduling method can be executed by database nodes in the distributed database, or it can be executed jointly by a scheduling terminal and database nodes. In this embodiment, the method is described using the execution of the database node as an example. (Refer to...) Figure 3 The data scheduling method for distributed databases includes, but is not limited to, steps 310 to 330.
[0107] Step 310: Receive data distribution strategy binding instruction, wherein the data distribution strategy binding instruction specifies a first data distribution strategy for the first data table, and the first data distribution strategy is bound to a second data table;
[0108] Step 320: Bind the first data table to the first data distribution strategy according to the data distribution strategy binding instruction;
[0109] Step 330: According to the first data distribution strategy, schedule the data of the first data table and the data of the second data table so that the data of the first data table and the data of the second data table are stored in the same database node.
[0110] In one embodiment, the first data table can be a partition of a partitioned table or a non-partitioned table. Similarly, the second data table can also be a partition of a partitioned table or a non-partitioned table; no specific limitation is made here. Regardless of whether the first and second data tables are partitions or non-partitioned tables of different partitioned tables, or whether one of the first and second data tables is a partitioned table and the other is a non-partitioned table, the data in both tables can be scheduled to the same database node by binding them to the same first data distribution strategy. Furthermore, the second data table can be pre-bound to the first data distribution strategy; there can be one or more second data tables pre-bound to the first data distribution strategy, no specific limitation is made here.
[0111] In one embodiment, the data distribution strategy binding instruction can be carried in the data table creation request or sent separately after the data table is created. Correspondingly, the first data table can be a newly created data table or an already created data table. For example, in one implementation scenario, the data table creation request for creating the first data table carries the data distribution strategy binding instruction. When creating the first data table, the first data table is simultaneously bound to the first data table, so that after the first data table is created, the database node to which the data to be stored in the first data table will be indicated. In another implementation scenario, the data table creation request for creating the first data table does not carry the data distribution strategy binding instruction. After the first data table is created separately according to the data table creation request, the data to be stored in the first data table can be temporarily stored locally on the database node that created the first data table. After storing the data in the first data table, the data distribution strategy binding instruction can be received separately to bind the first data table to the first data distribution strategy that is pre-bound to the second data table, so that the data in the first data table can be scheduled to the same database node as the data in the second data table.
[0112] In one embodiment, data scheduling is based on a data distribution strategy. If the database has two identical data distribution strategies, and two data tables with business relationships are bound to these two identical data distribution strategies, when it is necessary to schedule the data of these two data tables to the same database node, the data of one data table will be scheduled because its bound data distribution strategy is triggered. However, the data distribution strategy bound to the other data table will not be triggered, so the data of that data table will not be scheduled. Therefore, it is impossible to achieve the goal of scheduling the data of these two data tables to the same database node. In other words, the data distribution strategy is unique, and only one identical data distribution strategy can exist. To ensure the uniqueness of the data distribution strategy, its uniqueness can be guaranteed during the creation process. For example, when creating the first data distribution strategy, the following steps can be used: first, receive the data distribution strategy creation instruction; then, create the first data distribution strategy according to the data distribution strategy creation instruction; next, perform a validity check on the first data distribution strategy; when the validity of the first data distribution strategy is determined to be valid, save the first data distribution strategy to the storage layer. The generated first data distribution strategy will be stored in the data dictionary set by the storage layer for subsequent use. By performing a validity check on the first data distribution strategy, conflicts between the first data distribution strategy and existing data distribution strategies in the storage layer can be reduced. This improves the independence of the first data distribution strategy in the storage layer, allowing data in the first and second data tables bound to the first data distribution strategy to be scheduled simultaneously. This reduces secondary scheduling and data scheduling anomalies, improving data scheduling efficiency and data integrity after scheduling. Furthermore, if the first data distribution strategy is determined to be invalid, an alarm message is issued to the user, and the creation of the data distribution strategy is terminated.
[0113] In one embodiment, when the current database node does not store the first data distribution strategy, but other database nodes do, the current database node can obtain the first data distribution strategy through the following steps: first, receive a data distribution strategy creation instruction; then, according to the instruction, obtain the first data distribution strategy stored by one of the database nodes other than the current one; next, perform a deduplication check between the obtained first data distribution strategy and the locally stored data distribution strategy; if the deduplication result shows that the first data distribution strategy is not present in the locally stored data distribution strategy, store the first data distribution strategy locally; if the deduplication result shows that the first data distribution strategy is present in the locally stored data distribution strategy, issue an alarm message indicating that the first data distribution strategy is invalid. Obtaining the first data distribution strategy in this way maintains the synchronization of data distribution strategies across database nodes in the distributed database system, thereby enabling all data in the distributed database system that is closely related at the business level to be scheduled to the same database node.
[0114] In one embodiment, the data distribution strategy creation instruction can be obtained through direct user input or generated by the internal system of the database node; no specific limitation is made here. For example, in one implementation scenario, the database node is equipped with a knowledge graph, which is built based on the relationships or business relationships between stored data tables. The database node can obtain business relationships based on the knowledge graph. Since business relationships can indicate whether the business connections between data tables are close, the data tables that need to be scheduled can be determined based on the business relationships. Assuming that it is determined that the first data table and the second data table have a close business relationship, a data distribution strategy creation instruction can be generated based on the first data table and the second data table. Then, a first data distribution strategy is created based on the data distribution strategy creation instruction, and both the first data table and the second data table are bound to the first data distribution strategy. This allows the data in the first data table and the data in the second data table to be scheduled based on the first data distribution strategy, thereby improving the matching degree between data scheduling and business relationships and improving the database's data retrieval capability. The first data distribution strategy created by the data distribution strategy creation instruction can schedule the data of the first data table to the database node where the second data table is located, or it can schedule the data of the first data table and the data of the second data table to the database node where the table with more entries is located, etc., without specific limitations here.
[0115] In one embodiment, the content of the first data distribution strategy can be compared with the content of multiple data distribution strategies stored in the storage layer. If no data distribution strategy with the same content as the first data distribution strategy is found in the storage layer, the legality of the first data distribution strategy can be determined to be legal.
[0116] In one embodiment, the first data distribution strategy may include strategy identification information. During the legality check of the first data distribution strategy, the strategy identification information can be searched in the storage layer. If the strategy identification information is not found, the legality of the first data distribution strategy can be determined. By introducing strategy identification information into the first data distribution strategy, the data distribution strategy corresponding to the strategy identification information can be quickly searched in the storage layer. Since the first data distribution strategy is unique, the strategy identification information is also unique. Therefore, when a data distribution strategy corresponding to the strategy identification information can be found in the storage layer, it means that the storage layer has already saved the data distribution strategy corresponding to the strategy identification information, and thus the legality of the currently created first data distribution strategy is invalid. When a data distribution strategy corresponding to the strategy identification information is not found in the storage layer, it means that the storage layer has not saved the data distribution strategy corresponding to the strategy identification information, and thus the legality of the currently created first data distribution strategy is valid. Therefore, compared with the method of querying based on the content of the first data distribution strategy, this legality check method can improve the query efficiency of the first data distribution strategy, thereby improving the efficiency of the legality check process. The policy identification information can be identity information or name information, without specific limitations here.
[0117] In one embodiment, the first data distribution strategy can be a newly created data distribution strategy or a data distribution strategy that has been persisted in the data dictionary for a relatively long time; no specific limitation is made here. Furthermore, the first data distribution strategy can instruct the data table bound to the strategy to store data in the database node where the first data table resides, or it can instruct the data table bound to the strategy to store data in a database node other than the database node where the first data table resides; no specific limitation is made here.
[0118] In one embodiment, some data tables stored on different database nodes have closely related entries at the business level. When a user needs to call data from a database node due to business requirements, the user terminal can make cross-node calls for the required data. Therefore, such data tables can be bound to the same data distribution strategy. Since such data tables can be bound to data distribution strategies based on entries with close business relationships, data tables containing the same or similar entries can be bound to the same data distribution strategy by detecting the entries. For example, the following steps can be used to bind data tables containing the same or similar entries to the same data distribution strategy: Before creating the data table, the data table creation process is configured in the database, including a step for searching table entry keywords. Then, during the creation process, keyword detection is performed on the entries in the newly created data table based on entries from one or more locally stored data tables. When the detection results indicate that the entries in the newly created data table are similar to or identical to entries from one or more locally stored data tables, a data distribution strategy binding instruction is generated based on the data distribution strategy corresponding to the data table containing the similar or identical entries. Finally, the newly created data table is bound to the data distribution strategy corresponding to the data table containing the similar or identical entries according to the binding instruction. This allows the data in the newly created data table to be scheduled according to the bound data distribution strategy, thereby improving the binding efficiency of the first data distribution strategy.
[0119] In one embodiment, during the process of binding the first data table to the first data distribution strategy according to the data distribution strategy binding instruction, the first data table can be associated with the second data table according to the data distribution strategy binding instruction, and the first data table can be bound to the first data distribution strategy. Because the first data table and the second data table are associated, during data scheduling, the associated second data table can be quickly found among multiple data tables stored locally on the node through the association between the first and second data tables. This allows for the rapid scheduling of data from both the first and second data tables to the same node. Therefore, associating the first and second data tables during the binding process of the first data table to the first data distribution strategy can improve data scheduling efficiency. Furthermore, associating the first and second data tables ensures that the data table structure definitions remain unchanged after data scheduling. This allows for quick querying of the scheduled data from both the first and second data tables. The association between the two tables allows for rapid data retrieval, reducing user awareness of distributed transaction changes. Furthermore, by associating the first and second tables, database nodes can schedule data based on this association before binding the first data table to the first data distribution strategy. During data scheduling, the database node simultaneously binds the first data table to the first data distribution strategy and then updates the data dictionary in the storage layer, updating the metadata of the first data distribution strategy. This enables parallel data scheduling and metadata updates, accelerating the binding process. The metadata of the data distribution strategy can include information about the data tables it is bound to.
[0120] Specifically, after establishing the association between the first data table and the second data table, the first data table, which has already been associated but has not yet been bound to the first data distribution strategy, is updated in the data dictionary of the storage layer to update the metadata of the first data table. This allows the association between the first data table and the second data table to be persisted in the data dictionary for subsequent use.
[0121] In addition, when one of the first and second data tables is a partition of a partitioned table and the other is a non-partitioned table, due to the association between the partitions of the non-partitioned table and the partitioned table, when binding an existing data distribution strategy to a data table that has not been bound to a data distribution strategy, more granular data distribution strategy binding can be achieved, thereby enabling the database node to perform data scheduling on partitions of multiple partitioned tables. For example, suppose a database node stores a non-partitioned table T1, partitioned tables Pt1 and Pt2. The non-partitioned table T1 (as the second data table) and partition Pt1.p0 of partitioned table Pt1 are pre-bound to a first data distribution strategy. To bind partition Pt2.p0 of partitioned table Pt2 (as the first data table) to the first data distribution strategy, the association between partition Pt2.p0 and non-partitioned table T1, and between partition Pt2.p0 and partition Pt1.p0, can be established first. Then, partition Pt2.p0 is bound, and data scheduling is performed according to the first data distribution strategy. During data scheduling, the database node can schedule data from non-partitioned table T1, partition Pt1.p0, and partition Pt2.p0 to the same node according to the first data distribution strategy. This improves the granularity of data scheduling, allowing partitions and non-partitioned tables from different partitioned tables to be stored on the same node simultaneously, thereby reducing distributed transaction compensation.
[0122] The following example illustrates in detail the data scheduling process involving the association between the first and second data tables.
[0123] Please see Figure 4 , Figure 4 This is a schematic diagram illustrating the data scheduling process for the association of a first data table and a second data table, provided as a specific example of this application. Figure 4 The diagram illustrates the scheduling layer, computation layer, and storage layer of a database node. When it is necessary to bind a first data table to a first data distribution strategy, the database node first retrieves the first data distribution strategy, the first data table, and a second data table pre-bound to the first data distribution strategy in the storage layer. Then, the database node associates the first and second data tables in the computation layer. After the association between the first and second data tables is completed, since the second data table is pre-bound to the first data distribution strategy, the database node can schedule the data of the second data table in the local scheduling layer according to the first data distribution strategy, and can also schedule the data of the first data table in the local scheduling layer according to the association between the first and second data tables. Then, the database node binds the first data table to the first data distribution strategy in the storage layer. After the first data table is bound to the first data distribution strategy, the database node stores the first data table associated with the second data table in the data dictionary of the storage layer.
[0124] The following example will be used to explain in detail the data scheduling process involving the association between the first data table and the second data table.
[0125] Please see Figure 5 , Figure 5 This is a schematic diagram illustrating the data scheduling process for the association of a first data table and a second data table, provided as another specific example of this application. Figure 5 The diagram illustrates the scheduling layer, computation layer, and storage layer of a database node. When it is necessary to bind a first data table to a first data distribution strategy, the database node first retrieves the first data distribution strategy, the first data table, and the second data table bound to the first data distribution strategy one by one in the storage layer. Then, the database node associates the first data table and the second data table in the computation layer. After completing the association between the first and second data tables, the database node can bind the first data table to the first data distribution strategy through the computation layer. Then, the database node can schedule the data of the first data table and the data of the second data table in the local scheduling layer according to the first data distribution strategy. After the first data table is bound to the first data distribution strategy, the database node stores the first data table associated with the second data table in the data dictionary of the storage layer.
[0126] See Figure 4 and Figure 5 In the embodiment shown, since the first data table bound to the first data distribution strategy needs to be stored in the data dictionary of the storage layer, the data added to the first data table later can still be scheduled according to the first data distribution strategy. In other words, when the first data table is bound to the first data distribution strategy and is not unbound, any data added to the first data table can be scheduled by the database so that the data in the first data table and the data in the second data table are stored in the same database node.
[0127] The following example illustrates in detail the data scheduling process involved in creating the first data distribution strategy.
[0128] Please see Figure 6 , Figure 6 This is a schematic diagram of the data scheduling process for creating a first data distribution strategy, provided as a specific example of this application. Figure 6The diagram illustrates the scheduling layer, computation layer, and storage layer of a database node. Assuming a database node is a newly set up database that does not store any data, in order to quickly establish new business relationships with other databases already in use, a data distribution strategy can be applied to bind the data tables that are subsequently created in this database. After creating the first and second data tables, the database node can first receive a data distribution strategy creation instruction. Then, in the computation layer, the database node can create the first data distribution strategy according to the instruction, whereby the first data distribution strategy includes strategy identification information. Next, the database node can search for the strategy identification information of the first data distribution strategy in the storage layer. Since no data is stored in the database, the strategy identification information cannot be found in the storage layer, thus confirming the validity of the first data distribution strategy. Once the validity of the first data distribution strategy is confirmed, the database node can sequentially retrieve the first data distribution strategy, the first data table, and the second data table pre-bound to the first data distribution strategy in the storage layer. Then, the database node can associate the first and second data tables in the computation layer. After associating the first and second data tables, the database node can bind the first and second data tables to the first data distribution strategy in the storage layer. After both the first and second data tables are bound to the first data distribution strategy, the database node stores the data of the first and second data tables in the data dictionary of the storage layer.
[0129] In one embodiment, the data distribution strategy may include information indicating the database node to which data scheduling is directed. The database node needs to correctly schedule the data in the data table bound to the data distribution strategy according to this information. If the bound data distribution strategy does not exist, the database node cannot correctly schedule the data in the data table bound to the data distribution strategy. To ensure the correctness of data scheduling by the database node, the correctness of data scheduling can be guaranteed during the process of binding the data table to the data distribution strategy. For example, before binding the first data table to the first data distribution strategy according to the data distribution strategy binding instruction, the first data distribution strategy can be searched in the storage layer according to the data distribution strategy binding instruction to determine its availability. If the first data distribution strategy is found, the second data table bound to the first data distribution strategy is obtained, and then the first data table and the second data table are associated. If the first data distribution strategy is not found, an alarm message indicating that the first data distribution strategy does not exist is issued to the user. By checking the availability of the first data distribution strategy, it can be ensured that the first data distribution strategy exists locally on the database node. This allows the data in the first data table and the data in the second data table to be scheduled simultaneously according to the first data distribution strategy, thereby improving the legality of data scheduling and the integrity of the data after scheduling.
[0130] For example, in one implementation scenario, the policy identification information of the first data distribution strategy can be searched in the storage layer. If no consistent policy identification information is found, the availability of the first data distribution strategy can be determined to be unavailable; if consistent policy identification information is found, the availability of the first data distribution strategy can be determined to be available.
[0131] The following example illustrates in detail the data scheduling process involving the legality check of the first data distribution strategy.
[0132] Please see Figure 7 , Figure 7 This is a schematic diagram of the data scheduling process for checking the legality of the first data distribution strategy, provided as a specific example of this application. Figure 7The diagram illustrates the scheduling layer, computation layer, and storage layer of a database node. When it is necessary to bind a first data table to a first data distribution strategy, the database node first queries the storage layer for the first data distribution strategy according to the data distribution strategy binding instruction. If the storage layer of the database node does not find the first data distribution strategy, the database node can issue an alarm message to the user and end the data distribution strategy binding process. If the storage layer of the database node finds the first data distribution strategy, the database node can retrieve the first data distribution strategy, the first data table, and the second data table pre-bound to the first data distribution strategy from the storage layer. Then, the database node can... In the computation layer, the first data table and the second data table are associated. After the association between the first and second data tables is completed, since the second data table is pre-bound to the first data distribution strategy, the database node can schedule the data of the second data table in the local scheduling layer according to the first data distribution strategy, and can also schedule the data of the first data table in the local scheduling layer according to the association between the first and second data tables. Then, in the storage layer, the database node binds the first data table to the first data distribution strategy. After the first data table is bound to the first data distribution strategy, the database node stores the first data table associated with the second data table in the data dictionary of the storage layer.
[0133] The following example will be used to explain in detail the data scheduling process involving the legality check of the first data distribution strategy.
[0134] Please see Figure 8 , Figure 8 A schematic diagram of the data scheduling process for the first data distribution strategy validity check, provided as another specific example of this application. Figure 8The diagram illustrates the scheduling layer, computation layer, and storage layer of a database. When it is necessary to bind a first data table to a first data distribution strategy, the database node first queries the storage layer for the first data distribution strategy according to the binding instruction. If the storage layer of the database node does not find the first data distribution strategy, the database node can issue an alarm message to the user and end the data distribution strategy binding process. If the storage layer of the database node finds the first data distribution strategy, the database node can obtain the first data distribution strategy, the first data table, and the second data table bound to the first data distribution strategy one by one through the computation layer in the storage layer. Then, the database node can associate the first data table and the second data table in the computation layer. After completing the association of the first data table and the second data table, the database node can bind the first data table to the first data distribution strategy through the computation layer. Then, the database node can schedule the data of the first data table and the data of the second data table in the local scheduling layer according to the first data distribution strategy. After the first data table is bound to the first data distribution strategy, the database node stores the first data table associated with the second data table in the data dictionary of the storage layer.
[0135] In one embodiment, for a database, since a data distribution strategy can specify the database node to which data scheduling points, when a data table is bound to two data distribution strategies and the two data distribution strategies specify different database nodes to which data scheduling points, the database node will simultaneously schedule data for the data table bound to both data distribution strategies according to the two data distribution strategies. This results in a portion of the data in the data table being scheduled to one database node and another portion of the data in the data table being scheduled to another database node, making it impossible to achieve the goal of scheduling the data of this data table to the same database node. In other words, the binding of a data table to a data distribution strategy must be unique. In order to ensure that the binding of a data table to a data distribution strategy is unique, a binding uniqueness check can be performed on the data table before binding to ensure the binding uniqueness of the data table. For example, before binding the first data table to the first data distribution strategy according to the binding instruction, the uniqueness of the binding of the first data table can be checked to determine whether the first data table can be bound to the first data distribution strategy. If the first data table is already bound to a data distribution strategy, an alarm message is sent to the user indicating that the first data table is bound to a data distribution strategy, and the binding process ends. If the first data table is not bound to a first data distribution strategy, the first data table is bound to the first data distribution strategy. By checking the uniqueness of the binding of the first data table, the possibility of conflicts between the first data distribution strategy and the data distribution strategies already bound to the first data table can be reduced, thereby improving the uniqueness of the binding between the first data strategy and the first data table. This, in turn, can improve the accuracy of data scheduling and reduce the situation where data is scattered across different database nodes after data scheduling.
[0136] For example, in one implementation scenario, metadata from multiple data distribution strategies in the storage layer is obtained. Based on this metadata, a table binding determination is performed on all data distribution strategies to determine whether a first data table has been bound to a data distribution strategy. If the metadata of one data distribution strategy indicates that the first data table is bound to that strategy, an alert is issued to the user, and the binding process ends. If the metadata of each data distribution strategy indicates that the first data table is not bound to that strategy, the first data table is bound to the first data distribution strategy.
[0137] The following example illustrates in detail the data scheduling process involving the binding uniqueness check of the first data table.
[0138] Please see Figure 9 , Figure 9 This is a data scheduling diagram illustrating the binding uniqueness check of the first data table, provided as a specific example of this application. Figure 9The diagram illustrates the scheduling layer, computation layer, and storage layer of the database. When it is necessary to bind a first data table to a first data distribution strategy, firstly, the computation layer of the database node can determine whether the first data table is already bound to a data distribution strategy based on the data distribution strategy binding instruction. If it finds that the first data table is already bound to a data distribution strategy, it sends an alarm message to the user and ends the binding process. If it finds that the first data table is not bound to a data distribution strategy, the database node queries the storage layer for the first data distribution strategy. If the database node does not find the first data distribution strategy in the storage layer, it can send an alarm message to the user and end the data distribution strategy binding process. If the database node finds the first data distribution strategy in the storage layer, it can retrieve the first data distribution strategy one by one from the storage layer. The database node first assigns a strategy, a first data table, and a second data table pre-bound to the first data distribution strategy. Then, the database node can associate the first and second data tables in the computation layer. After associating the first and second data tables, since the second data table is pre-bound to the first data distribution strategy, the database node can schedule the data in the second data table in the local scheduling layer according to the first data distribution strategy, and can also schedule the data in the first data table in the local scheduling layer according to the association between the first and second data tables. Then, the database node binds the first data table to the first data distribution strategy in the storage layer. After the first data table is bound to the first data distribution strategy, the database node stores the first data table, as associated with the second data table, in the data dictionary of the storage layer.
[0139] The following example will be used to explain in detail the data scheduling process involving the binding uniqueness check of the first data table.
[0140] Please see Figure 10 , Figure 10 This is a data scheduling diagram illustrating the binding uniqueness check of a first data table, provided as another specific example of this application. Figure 10The diagram illustrates the computation and storage layers of a database. When binding a first data table to a first data distribution strategy, the database node first queries the storage layer for the first data distribution strategy according to the binding instruction. If the database node does not find the first data distribution strategy in the storage layer, it can issue an alarm to the user and end the data distribution strategy binding process. If the database node finds the first data distribution strategy in the storage layer, it determines whether the first data table is already bound to a data distribution strategy. If it finds that the first data table is already bound to a data distribution strategy, it issues an alarm to the user and ends the binding process. If it finds that the first data table is not bound to a data distribution strategy, the database node can retrieve the first data distribution strategy and the first data distribution strategy from the storage layer one by one. The database node then associates the first and second data tables in the computation layer, based on the first data distribution strategy. After this association, the database node can schedule the data in the second data table at the local scheduling layer according to the first data distribution strategy, and also schedule the data in the first data table at the local scheduling layer based on the association between the first and second data tables. Next, the database node binds the first data table to the first data distribution strategy in the storage layer. After the first data table is bound to the first data distribution strategy, the database node stores the associated first data table in the data dictionary of the storage layer.
[0141] The following example will be used to explain in detail the data scheduling process involving the binding uniqueness check of the first data table.
[0142] Please see Figure 11 , Figure 11 This is a data scheduling diagram illustrating the binding uniqueness check of a first data table, provided as another specific example of this application. Figure 11The diagram illustrates the database's scheduling layer, computation layer, and storage layer. When binding a first data table to a first data distribution strategy, the database node's computation layer first determines whether the first data table is already bound to a data distribution strategy based on the binding instruction. If the first data table is found to be bound to a data distribution strategy, an alarm message is sent to the user, and the binding process ends. If the first data table is found not to be bound to a data distribution strategy, the database node queries the storage layer for the first data distribution strategy. If the database node does not find the first data distribution strategy in the storage layer, it can send an alarm message to the user and end the data distribution strategy binding process. If the database node finds the first data distribution strategy in the storage layer... The distribution strategy involves the database node sequentially retrieving a first data distribution strategy, a first data table, and a second data table bound to the first data distribution strategy from the storage layer. Then, the database node can associate the first and second data tables in the computation layer. After associating the first and second data tables, the database node can bind the first data table to the first data distribution strategy through the computation layer. Next, the database node can schedule the data in the first and second data tables in the local scheduling layer according to the first data distribution strategy. After the first data table is bound to the first data distribution strategy, the database node stores the first data table, associated with the second data table, in the data dictionary of the storage layer.
[0143] The following example will be used to explain in detail the data scheduling process involving the binding uniqueness check of the first data table.
[0144] Please see Figure 12 , Figure 12 This is a data scheduling diagram illustrating the binding uniqueness check of a first data table, provided as another specific example of this application. Figure 12The diagram illustrates the computation and storage layers of the database. When binding a first data table to a first data distribution strategy, the database node first queries the storage layer for the first data distribution strategy according to the binding instruction. If the database node does not find the first data distribution strategy in the storage layer, it can issue an alarm to the user and end the data distribution strategy binding process. If the database node finds the first data distribution strategy in the storage layer, it determines whether the first data table is already bound to a data distribution strategy. If it finds that the first data table is already bound to a data distribution strategy, it issues an alarm to the user and ends the binding process. If it finds that the first data table is not bound to a data distribution strategy, the data... The database node can retrieve the first data distribution strategy, the first data table, and the second data table bound to the first data distribution strategy one by one in the storage layer. Then, the database node can associate the first data table and the second data table in the computation layer. After completing the association of the first data table and the second data table, the database node can bind the first data table to the first data distribution strategy through the computation layer. Then, the database node can schedule the data of the first data table and the data of the second data table in the local scheduling layer according to the first data distribution strategy. After the first data table is bound to the first data distribution strategy, the database node stores the first data table associated with the second data table in the data dictionary of the storage layer.
[0145] Please see Figure 13 , Figure 13 This document presents a database query performance comparison chart provided in an embodiment of this application. When storing data from a distributed transaction in a database, users can increase the number of data tables and indexes as the data volume increases. These tables and indexes can be randomly distributed across different database nodes. However, as the number of tables and indexes increases, the compensation for distributed transactions also increases, leading to increasingly poor data query performance on the database nodes. By using the data scheduling method of this application, data bound to the same data distribution strategy will be scheduled to the same node. At this point, data from a distributed transaction can be queried on a single database node, thereby reducing distributed transaction compensation and improving data query performance (i.e., increasing queries per second (QPS)). Figure 13 As shown, Figure 13The paper illustrates the QPS corresponding to different numbers of indexes introduced in a distributed transaction. When no indexes are introduced in the distributed transaction, the difference between the QPS of various data distribution storage methods and the QPS of the data centralized storage method of this application is small. However, when one, two, four, and eight indexes are introduced in the distributed transaction, the difference between the QPS of the data centralized storage method of this application and the QPS of various data distribution storage methods gradually increases. It is evident that the data centralized storage method of this application can significantly improve data query performance.
[0146] In one embodiment, during the update process of compiling data distribution strategies for data tables, the data distribution strategies bound to the data tables can be unbound through the following steps: first, a strategy binding update instruction is received, wherein the strategy binding update instruction specifies a second data distribution strategy for a first data table, and the second data distribution strategy is bound to a third data table; then, according to the strategy binding update instruction, the binding between the first data table and the first data distribution strategy is released. By releasing the binding between the first data table and the first data distribution strategy, the scheduling of the first data table can be paused during subsequent data scheduling processes, thereby reducing the complexity of data scheduling when the data in the first data table no longer needs to be scheduled, and thus improving the current data scheduling capability.
[0147] In one embodiment, during the process of updating the data distribution strategy bound to a data table, the data distribution strategy bound to the data table can be updated through the following steps: First, a strategy binding update instruction is received, wherein the strategy binding update instruction specifies a second data distribution strategy for a first data table, and the second data distribution strategy is bound to a third data table; then, according to the strategy binding update instruction, the binding between the first data table and the first data distribution strategy is updated to a binding between the first data table and the second data distribution strategy; then, according to the second data distribution strategy, the data of the first data table and the data of the third data table are scheduled so that the data of the first data table and the data of the third data table are stored in the same database node. By changing the data distribution strategy bound to the first data table, the data scheduling process can be matched with changing business scheduling requirements, thereby improving the versatility of data scheduling and enabling the database to maintain high data retrieval efficiency for different business scheduling requirements.
[0148] In one embodiment, the third data table can be a partition of a partitioned table or a non-partitioned table; no specific limitation is made here. Regardless of whether the first and third data tables are partitions or non-partitioned tables of different partitioned tables, or whether one of the first and third data tables is a partition of a partitioned table and the other is a non-partitioned table, the data in the first and third data tables can be scheduled to the same database node by binding both the first and third data tables to the same second data distribution strategy.
[0149] In one embodiment, to ensure the uniqueness of the second data distribution strategy, its uniqueness can be guaranteed during its creation. For example, the creation of the second data distribution strategy can be achieved through the following steps: First, deploy the strategy: receive a data distribution strategy creation instruction, then create the second data distribution strategy according to the instruction, and then perform a validity check on the second data distribution strategy. If the validity of the second data distribution strategy is determined to be valid, it is saved to the storage layer. The generated second data distribution strategy will be stored in the data dictionary set by the storage layer for subsequent use. By performing a validity check on the second data distribution strategy, conflicts between the second data distribution strategy and existing data distribution strategies in the storage layer can be reduced, thereby improving the independence of the second data distribution strategy in the storage layer. This allows data in the first and third data tables bound to the second data distribution strategy to be scheduled simultaneously after a data distribution strategy binding change, thus reducing secondary scheduling and data scheduling anomalies, improving data scheduling efficiency and data integrity after scheduling. In addition, when the legality of the second data distribution strategy is determined to be illegal, an alarm message is issued to the user and the creation of the data distribution strategy is terminated.
[0150] In one embodiment, the second data distribution strategy includes strategy identification information. During the legality check of the second data distribution strategy, the strategy identification information can be searched in the storage layer. If the strategy identification information is not found, the legality of the second data distribution strategy can be determined. By introducing strategy identification information into the second data distribution strategy, the data distribution strategy corresponding to the strategy identification information can be quickly searched in the storage layer. Since the second data distribution strategy is unique, the strategy identification information is also unique. Therefore, when a data distribution strategy corresponding to the strategy identification information can be found in the storage layer, it means that the storage layer has already saved the data distribution strategy corresponding to the strategy identification information, and thus the legality of the currently created second data distribution strategy is invalid. When a data distribution strategy corresponding to the strategy identification information is not found in the storage layer, it means that the storage layer has not saved the data distribution strategy corresponding to the strategy identification information, and thus the legality of the currently created second data distribution strategy is valid. Therefore, compared with the method of querying based on the content of the second data distribution strategy, this legality check method can improve the query efficiency of the second data distribution strategy, thereby improving the efficiency of the legality check process. The policy identification information can be identity information or name information, without specific limitations here.
[0151] In one embodiment, the policy binding update instruction can be carried in the creation request of a new data table, in the data table change request, or sent separately. Correspondingly, the first data table can be a newly created data table or an existing data table. For example, in one implementation scenario, the creation request for creating a third data table carries a data distribution policy binding instruction. When creating the third data table, a second data distribution policy is specified for the third data table and the data distribution policy of the first data table is reassigned to the second data distribution policy. In another implementation scenario, the third data table has been created and pre-bound with a second data distribution policy. If adjustments to the data and data scheduling in the first data table are needed, the policy binding update instruction can be carried in the data table change request for the first data table, thereby reassigning the second data distribution policy for the first data table. In yet another implementation scenario, the stored data in the first data table does not need to be changed, but the data scheduling of the first data table needs to be readjusted. The database node can receive the policy binding update instruction separately, thereby reassigning the second data distribution policy for the first data table. No specific limitations are imposed here.
[0152] In one embodiment, the policy binding update instruction can be generated by creating a new table. In one implementation scenario, after the third data table is created, it is bound to the second data distribution policy. To improve scheduling efficiency, after binding the third data table to the second data distribution policy, multiple data tables can be traversed. The correlation between the table entries in each data table and the table entries in the third data table is determined. If a close correlation is found between the table entries in the first data table and the table entries in the third data table, it is determined whether the first data table is already bound to a data distribution policy. If the first data table is found to be pre-bound to the first data distribution policy, a policy binding update instruction is generated; if the first data table is not bound to a data distribution policy, a data distribution policy binding instruction is generated.
[0153] In one embodiment, the second data distribution strategy can be either a data scheduling-based or a non-data scheduling-based strategy. For example, in one implementation scenario, the second data distribution strategy is a data scheduling-based strategy. After binding the first data table and the third data table to the second data distribution strategy, the data in the first data table and the data in the third data table are scheduled on the same database node. In another implementation scenario, the second data distribution strategy is a non-data scheduling-based strategy. After binding the first data table and the third data table to the second data distribution strategy, the scheduling of data in the first data table and the data in the third data table is stopped. No specific limitations are imposed here. When the second data distribution strategy is a non-data scheduling-based strategy, the database node can stop scheduling data in the first data table according to the second data distribution strategy, thereby substantially debinding the first data table from the first data distribution strategy, reducing data scheduling complexity, and improving data scheduling capabilities.
[0154] In one embodiment, to ensure the uniqueness of data table bindings to data distribution strategies, a uniqueness check can be performed on the data tables before updating the bindings. For example, before updating the bindings, the binding between the first data table and the first data distribution strategy can be released according to the strategy binding update instruction; then, the first data table can be bound to the second data distribution strategy. By unbinding the first data table before updating the bindings, conflicts between the first and second data distribution strategies can be reduced, thereby ensuring the uniqueness of the bindings between the second data strategy and the first data table. This improves the accuracy of data scheduling and reduces the likelihood of data from the first and third data tables residing on different database nodes after data scheduling.
[0155] In one embodiment, before unbinding the first data table from the first data distribution strategy, the database node can determine whether the first data distribution strategy has been unbound from the first data table. If it is found that the first data table and the first data distribution strategy have been unbound, the first data table and the second data distribution strategy are bound together; if it is found that the first data table and the first data distribution strategy have not been unbound, the first data table and the first data distribution strategy are unbound.
[0156] In one embodiment, during the process of binding the first data table to the second data distribution strategy according to the strategy binding update instruction, the first data table can be associated with the third data table and bound to the second data distribution strategy according to the strategy binding update instruction. Because the first data table is associated with the third data table, during data scheduling, the associated third data table can be quickly found among multiple data tables stored locally on the node through the association between the first and third data tables. This allows for the rapid scheduling of data from both the first and third data tables to the same node. Therefore, associating the first and third data tables during the process of binding the first data table to the second data distribution strategy improves data scheduling efficiency. Furthermore, associating the first and third data tables ensures that their data table structures remain unchanged after data scheduling, allowing the first data table to maintain its association with the third data table after data scheduling. The data indexing relationships between data tables reduce index lookup time and decrease user awareness of data scheduling. Furthermore, by associating the first and third data tables, the database node can schedule data based on the association between the first and third tables before binding the first table to the second data distribution strategy. During data scheduling, the database node can simultaneously bind the first table to the second data distribution strategy and update the data dictionary in the storage layer with this information, thus updating the metadata of the second data distribution strategy. This enables parallel data scheduling and metadata updates, accelerating the binding process of the second data distribution strategy. The metadata of the data distribution strategy can include information about the data tables to which the strategy is bound.
[0157] Specifically, after establishing the association between the first data table and the third data table, the third data table, which has already been associated but has not yet been bound to the first data distribution strategy, is updated in the data dictionary of the storage layer to update the metadata of the first data table. This allows the association between the first data table and the third data table to be persisted in the data dictionary for subsequent use.
[0158] Furthermore, when one of the first and third data tables is a partition of a partitioned table and the other is a non-partitioned table, due to the association between the partitions of the non-partitioned table and the partitioned table, more granular data distribution strategy binding can be achieved when binding an existing data distribution strategy to a data table that is not bound to a data distribution strategy. This allows the database node to perform data scheduling on partitions of multiple partitioned tables. For example, suppose a database node stores a non-partitioned table T1, partitioned tables Pt1 and Pt2. The non-partitioned table T1 (as the third data table) and the partition Pt1.p0 of partitioned table Pt1 are both pre-bound to the second data distribution strategy. Suppose the first data table is not bound to the first data distribution strategy. In this case, if we want to bind the second data distribution strategy to the partition Pt2.p0 of partitioned table Pt2 (as the first data table), we can first establish the association between partition Pt2.p0 and non-partitioned table T1, and the association between partition Pt2.p0 and partition Pt1.p0, respectively. Then, we bind partition Pt2.p0 to the second data distribution strategy. The data distribution strategy is first implemented, and then data scheduling is performed according to the second data distribution strategy. During the data scheduling process, the database node can schedule the data of non-partitioned table T1, partition Pt1.p0, and partition Pt2.p0 to the same node according to the first data distribution strategy. Thus, after changing the data distribution strategy bound to the first data table, the granularity of data scheduling can be improved. After changing the data distribution strategy bound to the first data table, partitions and non-partitioned tables in different partitioned tables can be stored on the same node at the same time, thereby enhancing the effect of reducing distributed transaction compensation.
[0159] The following example illustrates in detail the data scheduling process involving the association between the first and third data tables.
[0160] Please see Figure 14 , Figure 14 This is a schematic diagram illustrating the data scheduling process for the association of a first data table and a third data table, provided as a specific example of this application. Figure 14The diagram illustrates the scheduling layer, computation layer, and storage layer of a database. When it is necessary to change the data distribution strategy bound to the first data table, the database node first retrieves the first data distribution strategy from the data dictionary in the storage layer and unbinds the first data table and the first data distribution strategy in the computation layer. Then, the database node can retrieve the second data distribution strategy, the first data table, and the third data table bound to the second data distribution strategy one by one in the storage layer. Next, the database node can associate the first data table and the third data table in the computation layer. After the association between the first and third data tables is completed, since the third data table is pre-bound to the second data distribution strategy, the database node can schedule the data of the third data table in the local scheduling layer according to the second data distribution strategy, and can also schedule the data of the first data table in the local scheduling layer according to the association between the first and third data tables. Then, the database node binds the first data table to the second data distribution strategy in the storage layer. After the first data table is bound to the second data distribution strategy, the database node stores the first data table associated with the third data table in the data dictionary of the storage layer.
[0161] The following example will be used to explain in detail the data scheduling process involving the association between the first and third data tables.
[0162] Please see Figure 15 , Figure 15 This is a schematic diagram illustrating a data scheduling process for associating a first data table with a third data table, provided as another embodiment of this application. Figure 15 The diagram illustrates the scheduling layer, computation layer, and storage layer of a database. When it is necessary to change the data distribution strategy bound to the first data table, the database node first retrieves the first data distribution strategy from the data dictionary in the storage layer and unbinds the first data table and the first data distribution strategy in the computation layer. Then, the database node can retrieve the second data distribution strategy, the first data table, and the third data table bound to the second data distribution strategy one by one in the storage layer. Next, the database node can associate the first data table and the third data table in the computation layer. After completing the association of the first data table and the third data table, the database node can bind the first data table to the second data distribution strategy through the computation layer. Then, the database node can schedule the data of the first data table and the data of the third data table in the local scheduling layer according to the second data distribution strategy. After the first data table is bound to the second data distribution strategy, the database node stores the first data table associated with the third data table in the data dictionary of the storage layer.
[0163] In one embodiment, to ensure the correctness of data scheduling on the database node, the correctness of data scheduling can be guaranteed during the process of binding data tables to data distribution strategies. For example, before updating the binding between the first data table and the first data distribution strategy to a binding between the first data table and the second data distribution strategy according to the strategy binding update instruction, the second data distribution strategy can be searched in the storage layer according to the strategy binding update instruction, and its availability can be checked to determine its availability. When the second data distribution strategy is found, the third data table bound to the second data distribution strategy is obtained in the storage layer, and then the third data table is associated with the first data table in the computation layer. By checking the validity of the second data distribution strategy, it can be ensured that the second data distribution strategy exists locally on the database node, so that the data of the first data table and the data of the third data table can be scheduled simultaneously according to the second data distribution strategy, thereby improving the validity of data scheduling and the integrity of data after scheduling.
[0164] The following example illustrates in detail the data scheduling process involving the legality check of the third data distribution strategy.
[0165] Please see Figure 16 , Figure 16 This is a schematic diagram of the data scheduling process for checking the legality of a third data distribution strategy, provided as a specific example of this application. Figure 17The diagram illustrates the database's scheduling layer, computation layer, and storage layer. When it's necessary to change the data distribution strategy bound to the first data table, firstly, the database node's computation layer can query the storage layer for a second data distribution strategy based on the data distribution strategy binding instruction. If the database node does not find the second data distribution strategy in the storage layer, it can issue an alarm to the user and terminate the data distribution strategy binding process. If the database node finds the second data distribution strategy in the storage layer, it determines whether the first data table is bound to a data distribution strategy. If it finds that the first data table is bound to a first data distribution strategy, the database node retrieves the first data distribution strategy from the data dictionary in the storage layer and unbinds the first data table and the first data distribution strategy in the computation layer. If it finds that the first data table is not bound to a data distribution strategy or the unbinding between the first data table and the first data distribution strategy is completed, the database node can proceed as follows: In the storage layer, the database node can sequentially obtain the second data distribution strategy, the first data table, and the third data table bound to the second data distribution strategy. Then, in the computation layer, the database node can associate the first data table and the third data table. After the association between the first and third data tables is completed, since the third data table is pre-bound to the second data distribution strategy, the database node can schedule the data of the third data table in the local scheduling layer according to the second data distribution strategy, and can also schedule the data of the first data table in the local scheduling layer according to the association between the first and third data tables. Then, in the storage layer, the database node binds the first data table to the second data distribution strategy. After the first data table is bound to the second data distribution strategy, the database node stores the first data table associated with the third data table in the data dictionary of the storage layer.
[0166] The following example will be used to explain in detail the data scheduling process involving the legality check of the third data distribution strategy.
[0167] Please see Figure 17 , Figure 17 This is a schematic diagram of the data scheduling process for checking the legality of a third data distribution strategy, provided as another specific example of this application. Figure 17The diagram illustrates the database's scheduling layer, computation layer, and storage layer. When it's necessary to change the data distribution strategy bound to the first data table, firstly, the database node's computation layer can query the storage layer for a second data distribution strategy based on the data distribution strategy binding instruction. If the database node does not find the second data distribution strategy in the storage layer, it can issue an alarm to the user and terminate the data distribution strategy binding process. If the database node finds the second data distribution strategy in the storage layer, it determines whether the first data table is bound to a data distribution strategy. If it finds that the first data table is bound to the first data distribution strategy, the database node retrieves the first data distribution strategy from the data dictionary in the storage layer and unbinds the first data table and the first data distribution strategy in the computation layer. If it finds that the first data table is not bound to a data distribution strategy, the database node retrieves the first data distribution strategy from the data dictionary in the storage layer and unbinds the first data table and the first data distribution strategy in the computation layer. After the distribution strategy is completed or the first data table and the first data distribution strategy are unbound, the database node can obtain the second data distribution strategy, the first data table, and the third data table bound to the second data distribution strategy one by one in the storage layer. Then, the database node can associate the first data table and the third data table in the computation layer. After the association between the first data table and the third data table is completed, the database node can bind the first data table to the second data distribution strategy through the computation layer. Then, the database node can schedule the data of the first data table and the data of the third data table in the local scheduling layer according to the second data distribution strategy. After the first data table is bound to the second data distribution strategy, the database node stores the first data table associated with the third data table in the data dictionary of the storage layer.
[0168] In one embodiment, the data distribution strategy can be modified through the following steps: first, a data distribution strategy modification instruction is received, which includes the target data distribution strategy to be modified; then, according to the data distribution strategy modification instruction, a data table binding determination is performed on the target data distribution strategy; when it is determined that the target data distribution strategy is bound to a fourth data table, the binding between the target data distribution strategy and the fourth data table is released; finally, the target data distribution strategy is modified. By modifying the data distribution strategy, the data scheduling process can be matched with changing business scheduling requirements, thereby improving the versatility of data scheduling and enabling the database to maintain high data retrieval efficiency for different business scheduling needs.
[0169] In one embodiment, the target data distribution strategy can be any data distribution strategy, such as a first data distribution strategy, a second data distribution strategy, or a data distribution strategy other than the first and second data distribution strategies. No specific limitation is made here.
[0170] In one embodiment, the fourth data table can be one of the first, second, and third data tables, or it can be a data table other than the first, second, and third data tables. Furthermore, the fourth data table can be a partition of a partitioned table or a non-partitioned table; no specific limitation is made here.
[0171] In one embodiment, the data distribution strategy change instruction can be used to modify or delete an existing data distribution strategy. For example, in one implementation scenario, a fourth data table is pre-bound to a target data distribution strategy. The change operation specified by the data distribution strategy change instruction is modification. First, the binding between the fourth data table and the target data distribution strategy is unbound. After unbinding the target data distribution strategy from the fourth data table, the target data distribution strategy is modified. If no data distribution strategy binding instruction is received after unbinding the fourth data table from the target data distribution strategy, the fourth data table will remain in an unbound state and will not be bound to the modified target data distribution strategy. In another example, in one implementation scenario, the fourth data table is bound to a target data distribution strategy. The change operation specified by the data distribution strategy change instruction is deletion. First, the binding between the fourth data table and the target data distribution strategy is unbound. After unbinding the target data distribution strategy from the fourth data table, the target data distribution strategy is deleted. If no data distribution strategy binding instruction is received after unbinding the fourth data table from the target data distribution strategy, the fourth data table will remain in an unbound state and will not be bound to any other existing data distribution strategies. No specific limitations are imposed here.
[0172] In one embodiment, during the process of determining the data table binding of the target data distribution strategy according to the data distribution strategy change instruction, the target data distribution strategy can be searched in the storage layer first according to the data distribution strategy change instruction; when the target data distribution strategy is found, the metadata of the target data distribution strategy is obtained in the storage layer, and the data table binding of the target data distribution strategy is determined according to the metadata.
[0173] In one embodiment, the data distribution strategy change instruction can be carried through a data table modification request, sent separately, or carried through a data table creation request; no specific limitation is made here.
[0174] For example, in one implementation scenario, suppose a new first data table needs to be created and this data table needs to be bound to a new first data distribution strategy to match the current business requirements. However, there is a conflict between the target data distribution strategy and the first data distribution strategy to be created. In order to ensure the uniqueness of the data distribution strategy, the target data distribution strategy can be changed during the creation of the first data table. For example, the creation request for creating the first data table can carry both a data distribution strategy binding instruction and a data distribution strategy change instruction. The database node can first change the target data distribution strategy according to the data distribution strategy change instruction, then create the first data table, and then bind the first data table and the first data distribution strategy according to the data distribution strategy binding instruction.
[0175] For example, in one implementation scenario, suppose the table entries in the fourth data table need to be modified. After the modification, the fourth data table will have new and close relationships with other data tables at the business level. In order to make the modified fourth data table match the new business relationship, the data table modification request can carry both a data distribution strategy change instruction and a data distribution strategy binding instruction to change the target distribution strategy. For example, the database node can first unbind the fourth data table from the target data distribution strategy according to the data distribution strategy change instruction, then modify the target data distribution strategy, and finally bind the fourth data table to the modified target data distribution strategy according to the data distribution strategy binding instruction.
[0176] In one embodiment, the timing of data scheduling for the fourth data table is difficult to determine. If the target data distribution strategy is changed while the fourth data table is bound to it, and data scheduling occurs during the change process, the database node to which the data scheduling of the fourth data table points will change, leading to data loss or data corruption. To ensure the correctness of data scheduling, the change status of the target data distribution strategy can be determined before changing the target data distribution strategy to ensure the correctness and uniqueness of subsequent data scheduling. For example, during the process of determining the data table binding of the target data distribution strategy according to the data distribution strategy change instruction, the target data distribution strategy can be searched in the storage layer according to the data distribution strategy change instruction. When the target data distribution strategy is found, its metadata is obtained in the storage layer, and the data table binding of the target data distribution strategy is determined based on the metadata. If the metadata indicates that the target data distribution strategy is bound to the fourth data table, it can be determined that the target data distribution strategy is in an unchangeable state. If the metadata indicates that the target data distribution strategy is not bound to the fourth data table, it can be determined that the target data distribution strategy is in a changeable state. By checking the availability of the fourth data table to determine whether the target data distribution strategy is in a changeable state, the conflict between changes to the target data distribution strategy and the data scheduling process can be reduced, thereby improving data integrity.
[0177] In one embodiment, a database node can obtain a target data distribution strategy through the following steps: first, receiving a data distribution strategy creation instruction; then, creating the target data distribution strategy according to the instruction; and finally, performing a validity check on the target data distribution strategy. If the target data distribution strategy is deemed valid, it is saved to the storage layer. If the target data distribution strategy is deemed invalid, an alarm message is sent to the user. By performing a validity check on the target data distribution strategy, conflicts between the target data distribution strategy and existing data distribution strategies in the storage layer can be reduced.
[0178] In one embodiment, the target data distribution strategy includes strategy identification information. During the legality check of the target data distribution strategy, the strategy identification information can be searched in the storage layer. If the strategy identification information is not found, the legality of the target data distribution strategy can be determined to be legal, and then the target data distribution strategy is saved to the storage layer. If the strategy identification information is found, the legality of the target data distribution strategy can be determined to be illegal, and an alarm message is issued to the user.
[0179] In one embodiment, before modifying the target data distribution strategy, the availability of the target data distribution strategy can be determined by searching for the target data distribution strategy in the storage layer according to the data distribution strategy modification instruction. If the target data distribution strategy is found, the fourth data table bound to the target data distribution strategy is obtained in the storage layer, and then the fourth data table is unbound from the target data distribution strategy. If the target data distribution strategy is not found, an alarm message is issued to the user.
[0180] The following example illustrates in detail the process of modifying a data distribution strategy.
[0181] Please see Figure 18 , Figure 18 This application provides a specific example of a data distribution strategy change process diagram. Figure 18 The diagram illustrates the computation and storage layers of a database. Assuming the data distribution strategy change instruction indicates a modification operation, the database node can search for the target data distribution strategy in the storage layer based on the instruction. If the target data distribution strategy is not found, an alarm is issued to the user, and the data distribution strategy change process ends. If the target data distribution strategy is found, the database node retrieves its metadata in the storage layer and then performs a data table binding check based on the metadata. If the metadata indicates that the target data distribution strategy is not currently bound to any data table, the target data distribution strategy is modified, and the modified target data distribution strategy is persisted to the data dictionary in the storage layer. If the metadata indicates that the target data distribution strategy is bound to a fourth data table, the database node can retrieve the target data distribution strategy and the fourth data table one by one in the storage layer. Then, in the computation layer, the fourth data table and the target data distribution strategy are unbound, the unbound target data distribution strategy is modified, and the modified target data distribution strategy is persisted to the storage layer.
[0182] The following example will illustrate the process of modifying data distribution strategies in detail.
[0183] Please see Figure 19 , Figure 19 This application provides another specific example of a data distribution strategy change process diagram. Figure 19The diagram illustrates the computation and storage layers of a database. Assuming the data distribution policy change instruction indicates deletion, the database node can search for the target data distribution policy in the storage layer based on the instruction. If no target data distribution policy is found, an alert is issued to the user, and the data distribution policy change process ends. If a target data distribution policy is found, the database node retrieves its metadata in the storage layer and then performs a table binding check based on the metadata. If the metadata indicates that the target data distribution policy is not currently bound to any table, the database node deletes the target data distribution policy in the storage layer, along with its metadata. If the metadata indicates that the target data distribution policy is currently bound to a fourth table, the database node can retrieve both the target data distribution policy and the fourth table in the storage layer. Then, in the computation layer, the fourth table and the target data distribution policy are unbound. Finally, the unbound target data distribution policy is deleted in the storage layer, along with its metadata.
[0184] Please see Figure 20 , Figure 20 This is a detailed flowchart of a data scheduling method for a distributed database provided in a specific embodiment of this application. Figure 20 In this context, the data scheduling method for distributed databases may include, but is not limited to, steps 2001 to 2024.
[0185] Step 2001: Receive the data distribution strategy creation instruction.
[0186] In one embodiment, a first data distribution strategy is created according to a data distribution strategy creation instruction. The first data distribution strategy includes strategy identification information.
[0187] Step 2002: Create the first data distribution strategy according to the data distribution strategy creation instruction.
[0188] Step 2003: Locate the policy identification information of the first data distribution strategy in the storage layer.
[0189] Step 2004: Determine whether the strategy identifier information of the first data distribution strategy is found. If the strategy identifier information of the first data distribution strategy is not found, proceed to step 2005; if the strategy identifier information of the first data distribution strategy is found, proceed to step 2006.
[0190] Step 2005: Determine the validity of the first data distribution strategy as valid, and then proceed to step 2007.
[0191] Step 2006: Determine that the first data distribution strategy is invalid, end the creation of the first data distribution strategy, and issue an alarm.
[0192] Step 2007: Save the first data distribution strategy to the storage layer.
[0193] Step 2008: Receive data distribution strategy binding instructions.
[0194] Step 2009: According to the data distribution strategy binding instruction, search for the first data distribution strategy in the storage layer and determine whether the first data distribution strategy is stored in the storage layer. If the first data distribution strategy is not found, proceed to step 2010; if the first data distribution strategy is found, proceed to step 2011.
[0195] Step 2010: End the binding of the data distribution strategy to the first data table and issue an alarm.
[0196] Step 2011: Obtain the second data table bound to the first data distribution strategy in the storage layer, and execute step 2012.
[0197] Step 2012: According to the data distribution strategy binding instruction, associate the first data table with the second data table, and bind the first data table with the first data distribution strategy.
[0198] Step 2013: Receive policy binding update command.
[0199] Step 2014: According to the policy binding update instruction, search for the second data distribution policy in the storage layer and determine whether the second data distribution policy is stored in the storage layer. If the second data distribution policy is not found, proceed to step 2015; if the first data distribution policy is found, proceed to step 2016.
[0200] Step 2015: End the data distribution strategy binding update for the first data table and issue an alarm.
[0201] Step 2016: Obtain the third data table bound to the second data distribution strategy in the storage layer, and proceed to step 2017.
[0202] Step 2017: Associate the first data table with the third data table, and bind the first data table with the second data distribution strategy.
[0203] Step 2018: Receive the data distribution strategy change instruction.
[0204] Step 2019: According to the data distribution strategy change instruction, search for the target data distribution strategy in the storage layer and determine whether the target data distribution strategy is stored in the storage layer. If the target data distribution strategy is not found, proceed to step 2020; if the target data distribution strategy is found, proceed to step 2021.
[0205] Step 2020: End the data distribution strategy change and issue an alert.
[0206] Step 2021: Obtain the metadata of the target data distribution strategy in the storage layer.
[0207] In one embodiment, the target data distribution strategy is a first data distribution strategy, and the fourth data table is the first data table.
[0208] Step 2022: Determine the data table binding for the target data distribution strategy based on the metadata. If it is determined that the target data distribution strategy is bound to a fourth data table, proceed to step 2023; if it is determined that the target data distribution strategy is not bound to a data table, proceed to step 2024.
[0209] Step 2023: Unbind the target data distribution strategy from the fourth data table and proceed to step 2024.
[0210] Step 2024: Modify the target data distribution strategy.
[0211] In this embodiment of the application, the data scheduling method for a distributed database in steps 2001 to 2024 described above first receives a data distribution strategy binding instruction that specifies a first data distribution strategy for a first data table, wherein the first data distribution strategy is bound to a second data table. Then, according to the data distribution strategy binding instruction, the first data table is bound to the first data distribution strategy. Next, according to the first data distribution strategy, the data of the first data table and the data of the second data table are scheduled so that the data of the first data table and the data of the second data table are stored on the same node. This is because the data of the first data table and the data of the second data table can be stored on the same node because both the first data table and the second data table are bound to the same first data distribution strategy. Therefore, even if the first data table is a non-partitioned table and the second data table is a partition of a partitioned table, the partitioning properties of the first and second data tables can be disregarded, and both tables can be directly bound to the same first data distribution strategy. This allows the data in the first and second tables to be scheduled and stored on the same node, reducing distributed transaction compensation and improving the data retrieval performance of the distributed database. Furthermore, since both the scheduled data and the data originally stored on the node can be retrieved locally, changes in the node cluster will not affect the node's local data retrieval, ensuring data retrieval stability and improving the user experience.
[0212] The following examples illustrate the application scenarios of the embodiments of this application.
[0213] It should be noted that the data scheduling method for distributed databases provided in this application embodiment can be applied to different application scenarios such as game character attribute query, intelligent transportation system traffic flow data query, and social media platform recommendation information query. The following description will take the game character attribute query scenario, intelligent transportation system traffic flow data query scenario, and social media platform recommendation information query scenario as examples.
[0214] Scene 1
[0215] The data scheduling method for distributed databases provided in this application can be applied to the scenario of querying game character attributes. For example, the attributes of game characters in a game change with the version of the game. For different game versions, the calculation method of game character attributes may be different. The attributes of game characters may introduce some new factors to participate in the calculation, which may make some factors closely related at the business level in a certain version. Assuming that the factors used for attribute calculation in the previous version are stored in the first database node, and the user queries the attributes through the first database node, the data corresponding to the newly added factors are stored in the first data table and the second data table respectively. The first data table is a partition of a partitioned table, and the second data table is a non-partitioned table. The first data table and the second data table are stored in the first database, which is located in the second database node.
[0216] The computation layer of the first database can receive data distribution strategy binding instructions. These instructions specify a first data distribution strategy for the first data table, which binds to the second data table. Based on the binding instructions, an availability query is first performed on the first data distribution strategy to ensure it has been created in the first database. Once the first data distribution strategy is persisted to the storage layer, the first and second data tables are associated, and the first table and the first data distribution strategy are bound. The first database then schedules data from the first and second data tables to the first database node according to the first data distribution strategy. This allows users to directly access the data corresponding to the original computational factors and the data corresponding to newly added factors locally when querying game character attributes, without needing to perform cross-database node calls to retrieve the data corresponding to the newly added factors from the second database node. This improves the user query experience and reduces the likelihood of slow game character attribute display due to unreasonable data distribution.
[0217] Scene 2
[0218] The data scheduling method for distributed databases provided in this application can be applied to traffic flow data queries in intelligent transportation systems. For example, in urban traffic, some roads experience significant fluctuations in traffic flow, such as peak traffic during rush hours and average traffic flow at other times. To ensure smooth traffic flow, the concept of tidal traffic is introduced into the relevant transportation system. By predicting traffic flow, traffic lights are reconfigured to minimize vehicle waiting time at traffic lights (i.e., following the suggested speed on road signs ensures a continuous green light cycle). Due to the demands of traffic operations, vehicle data and road... Road data is typically stored using different data tables. Assuming vehicle data is stored in a first, non-partitioned table, containing geographic location information including the location and corresponding time, and road data is stored in a second, partitioned table, which is a sub-partition of a partitioned table, both tables reside in a first database node. When predicting tidal traffic flow, the prediction node needs to retrieve data from both the first and second tables from the first database node. This cross-database node data retrieval method results in relatively slow adjustments to tidal traffic flow. Therefore, the data from both tables can be routed to the prediction database node, allowing the prediction node to directly access data locally, thus improving the efficiency of tidal traffic flow prediction.
[0219] Specifically, the computation layer of the first database can receive a data distribution strategy binding instruction. This instruction specifies a first data distribution strategy for the first data table, which binds to the second data table. Based on the binding instruction, an availability query is first performed on the first data distribution strategy to ensure that the first database has created the first data distribution strategy. Once the first data distribution strategy has been persisted to the storage layer, the first data table and the second data table are associated, and the first data table and the first data distribution strategy are bound together. The first database will then schedule the data from the first data table and the data from the second data table to the prediction nodes according to the first data distribution strategy. This allows the prediction nodes to directly access road data and vehicle geographic location information locally, improving data retrieval efficiency and thus increasing the prediction efficiency of tidal traffic flow.
[0220] Scene 3
[0221] The data scheduling method for distributed databases provided in this application can be applied to recommendation information queries on social media platforms. For example, human thinking is influenced by the environment, and different environments evoke different desires. Therefore, it is necessary to call geographic location data during the recommendation calculation process to introduce the influence of location factors. The recommendation model for generating recommendation information is stored in a first database node. A second database node is configured with a first database, which stores a first data table and a second data table. The first data table is a non-partitioned table that stores the user's browsing history data. The second data table is a partition of a partitioned table that stores the geographic location data corresponding to the user's browsing history. When recommendation information needs to be generated, the first database node needs to call the browsing history data in the first data table and the geographic location data in the second data table through cross-database node calls. This cross-database node data call method makes recommendation information generation slow. In some cases, the slow data call speed leads to slow recommendation information generation, causing users to wait for recommendation information to be pushed when querying it. To address this, the data from the first data table and the second data table can be scheduled to the first database node, allowing the first database node to directly call data locally, thus improving the efficiency of recommendation information generation.
[0222] Specifically, the computation layer of the first database can receive a data distribution strategy binding instruction. This instruction specifies a first data distribution strategy for the first data table, which binds to the second data table. Based on the binding instruction, an availability query is first performed on the first data distribution strategy to ensure that the first database has created it. Once the first data distribution strategy is persisted to the storage layer, the first and second data tables are associated, and the first data table and the first data distribution strategy are bound together. The first database then schedules browsing history data from the first data table and geographic location data from the second data table to the first database node according to the first data distribution strategy. This allows the first database node to directly access browsing history data and vehicle geographic location data locally, improving the efficiency of recommendation information generation and thus enhancing the user experience.
[0223] It is understood that although the steps in the above flowcharts are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated in this embodiment, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the above flowcharts may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages in other steps.
[0224] Reference Figure 21 This application also discloses a data scheduling device for a distributed database. This data scheduling device 2100 can implement the data scheduling method for a distributed database described in the preceding embodiments. The data scheduling device 2100 includes:
[0225] The binding instruction receiving unit 2110 is used to receive a data distribution strategy binding instruction, wherein the data distribution strategy binding instruction specifies a first data distribution strategy for a first data table, and the first data distribution strategy is bound to a second data table.
[0226] The strategy binding unit 2120 is used to bind the first data table to the first data distribution strategy according to the data distribution strategy binding instruction;
[0227] The data scheduling unit 2130 is used to schedule the data of the first data table and the data of the second data table according to the first data distribution strategy, so that the data of the first data table and the data of the second data table are stored in the same database node.
[0228] In one embodiment, the policy binding unit 2120 is further configured to:
[0229] According to the data distribution strategy binding instruction, the first data table is bound to the first data distribution strategy.
[0230] In one embodiment, the data scheduling device 2100 for a distributed database further includes:
[0231] The first strategy lookup unit is used to look up the first data distribution strategy in the storage layer according to the data distribution strategy binding instruction.
[0232] The first data table acquisition unit is used to acquire the second data table bound to the first data distribution strategy in the storage layer when the first data distribution strategy is found.
[0233] In one embodiment, the data scheduling device 2100 for a distributed database further includes:
[0234] The update instruction receiving unit is used to receive the strategy binding update instruction, wherein the strategy binding update instruction specifies a second data distribution strategy for the first data table, and the second data distribution strategy is bound to a third data table.
[0235] The binding update unit is used to update the binding between the first data table and the first data distribution strategy to the binding between the first data table and the second data distribution strategy according to the strategy binding update instruction.
[0236] The data rescheduling unit is used to schedule the data of the first data table and the data of the third data table according to the second data distribution strategy, so that the data of the first data table and the data of the third data table are stored in the same database node.
[0237] In one embodiment, the binding update unit is further configured to:
[0238] According to the policy binding update instruction, the binding between the first data table and the first data distribution policy is released;
[0239] Bind the first data table to the second data distribution strategy.
[0240] In one embodiment, the binding update unit is further configured to:
[0241] Associate the first data table with the third data table, and bind the first data table with the second data distribution strategy.
[0242] In one embodiment, the data scheduling device 2100 for a distributed database further includes:
[0243] The instruction receiving unit is configured to receive a data distribution strategy change instruction, wherein the data distribution strategy change instruction includes the target data distribution strategy to be changed.
[0244] The binding judgment unit is used to perform data table binding judgment on the target data distribution strategy according to the data distribution strategy change instruction.
[0245] The strategy unbinding unit is used to unbind the target data distribution strategy from the fourth data table when it is determined that the target data distribution strategy is bound to the fourth data table.
[0246] The strategy change unit is used to change the target data distribution strategy.
[0247] In one embodiment, the binding determination unit is further configured to:
[0248] Based on the data distribution strategy modification instructions, locate the target data distribution strategy in the storage layer;
[0249] Once the target data distribution strategy is found, the metadata of the target data distribution strategy is retrieved from the storage layer;
[0250] The target data distribution strategy is determined by binding data tables based on metadata.
[0251] In one embodiment, the data scheduling device 2100 for a distributed database further includes a policy creation unit, which is used for:
[0252] Receive data distribution strategy creation instructions;
[0253] Create a first data distribution strategy based on the data distribution strategy creation instructions;
[0254] Perform a legality check on the first data distribution strategy;
[0255] Once the validity of the first data distribution strategy is determined to be valid, the first data distribution strategy is saved to the storage layer.
[0256] In one embodiment, the first data distribution strategy includes strategy identification information, and the strategy creation unit is further configured to:
[0257] Locate the policy identification information in the storage layer;
[0258] If no strategy identifier information is found, the validity of the first data distribution strategy is determined to be valid.
[0259] It should be noted that since the data scheduling device 2100 for distributed databases in this embodiment can implement the data scheduling method for distributed databases as in the previous embodiment, the data scheduling device 2100 for distributed databases in this embodiment has the same technical principle and the same beneficial effect as the data scheduling method for distributed databases in the previous embodiment. To avoid repetition, it will not be described again here.
[0260] Reference Figure 22 This application also discloses an electronic device, the electronic device 2200 comprising:
[0261] At least one processor 2201;
[0262] At least one memory 2202 is used to store at least one program;
[0263] When at least one program is executed by at least one processor 2201, the data scheduling method for distributed databases as described above is implemented.
[0264] This application also discloses a computer-readable storage medium storing a processor-executable computer program, which, when executed by a processor, is used to implement the data scheduling method for a distributed database as described above.
[0265] This application also discloses a computer program product, including a computer program or computer instructions, which are stored in a computer-readable storage medium. The processor of an electronic device reads the computer program or computer instructions from the computer-readable storage medium and executes the computer program or computer instructions, causing the electronic device to perform the data scheduling method for a distributed database as described above.
[0266] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented, for example, in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatuses.
[0267] It should be understood that in this application, "at least one (item)" means one or more, and "more than" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one (item) of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.
[0268] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, apparatuses, or units, and may be electrical, mechanical, or other forms.
[0269] In this application embodiment, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.
[0270] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0271] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0272] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0273] The step numbers in the above method embodiments are set only for ease of explanation and do not impose any restrictions on the order of the steps. The execution order of each step in the embodiments can be adaptively adjusted according to the understanding of those skilled in the art.
Claims
1. A data scheduling method for a distributed database, characterized in that, Includes the following steps: Receive a data distribution strategy binding instruction, wherein the data distribution strategy binding instruction specifies a first data distribution strategy for a first data table, the first data distribution strategy is bound to a second data table, the first data table and the second data table have a business relationship, the first data distribution strategy includes strategy identification information, and the strategy identification information is used to determine whether the first data distribution strategy has been saved in the storage layer; According to the data distribution strategy binding instruction, the first data table is associated with the second data table, and the first data table is bound to the first data distribution strategy; According to the first data distribution strategy, the data of the first data table and the data of the second data table are scheduled so that the data of the first data table and the data of the second data table are stored in the same database node; The method further includes: Receive a policy binding update instruction, wherein the policy binding update instruction specifies a second data distribution policy for the first data table, and the second data distribution policy is bound to a third data table; According to the strategy binding update instruction, the second data distribution strategy is searched in the storage layer; When the second data distribution strategy is found, the third data table bound to the second data distribution strategy is retrieved from the storage layer; According to the strategy binding update instruction, the binding between the first data table and the first data distribution strategy is released; Associate the first data table with the third data table, and bind the first data table with the second data distribution strategy; According to the second data distribution strategy, the data in the first data table and the data in the third data table are scheduled so that the data in the first data table and the data in the third data table are stored in the same database node.
2. The method of claim 1, wherein, Before binding the first data table to the first data distribution strategy according to the data distribution strategy binding instruction, the method further includes: According to the data distribution strategy binding instruction, the first data distribution strategy is searched in the storage layer; When the first data distribution strategy is found, the second data table bound to the first data distribution strategy is retrieved from the storage layer.
3. The method of claim 1, wherein, The method further includes: Receive a data distribution strategy change instruction, wherein the data distribution strategy change instruction includes the target data distribution strategy to be changed; According to the data distribution strategy change instruction, perform a data table binding judgment on the target data distribution strategy; When it is determined that the target data distribution strategy is bound to a fourth data table, the binding between the target data distribution strategy and the fourth data table is released; The target data distribution strategy is modified.
4. The method of claim 3, wherein, The step of performing data table binding judgment on the target data distribution strategy according to the data distribution strategy change instruction includes: According to the data distribution strategy change instruction, the target data distribution strategy is located in the storage layer; Once the target data distribution strategy is found, the metadata of the target data distribution strategy is obtained from the storage layer; The target data distribution strategy is determined by binding data tables based on the metadata.
5. The method of claim 1, wherein, The first data distribution strategy is created according to the following steps: Receive data distribution strategy creation instructions; The first data distribution strategy is created according to the data distribution strategy creation instruction; Perform a legality check on the first data distribution strategy; Once the validity of the first data distribution strategy is determined to be valid, the first data distribution strategy is saved to the storage layer.
6. The method of claim 5, wherein, The legality check of the first data distribution strategy includes: The policy identification information is located in the storage layer; If the strategy identifier information is not found, the first data distribution strategy is deemed to be legal.
7. A data scheduling apparatus for a distributed database, characterized by comprising: include: A binding instruction receiving unit is used to receive a data distribution strategy binding instruction, wherein the data distribution strategy binding instruction specifies a first data distribution strategy for a first data table, the first data distribution strategy is bound to a second data table, the first data table and the second data table have a business association relationship, and the first data distribution strategy includes strategy identification information, the strategy identification information being used to determine whether the first data distribution strategy has been saved in the storage layer. The strategy binding unit is used to associate the first data table with the second data table and bind the first data table with the first data distribution strategy according to the data distribution strategy binding instruction. The data scheduling unit is used to schedule the data of the first data table and the data of the second data table according to the first data distribution strategy, so that the data of the first data table and the data of the second data table are stored in the same database node. The data scheduling device for distributed databases further includes: An update instruction receiving unit is used to receive a strategy binding update instruction, wherein the strategy binding update instruction specifies a second data distribution strategy for the first data table, and the second data distribution strategy is bound to a third data table; The second strategy lookup unit is used to look up the second data distribution strategy in the storage layer according to the strategy binding update instruction. The second data table acquisition unit is used to acquire the third data table bound to the second data distribution strategy in the storage layer when the second data distribution strategy is found. The binding update unit is used to, according to the strategy binding update instruction, unbind the first data table from the first data distribution strategy, associate the first data table with the third data table, and bind the first data table to the second data distribution strategy; The data rescheduling unit is used to schedule the data of the first data table and the data of the third data table according to the second data distribution strategy, so that the data of the first data table and the data of the third data table are stored in the same database node.
8. An electronic device, comprising: include: At least one processor; At least one memory for storing at least one program; The data scheduling method for a distributed database as described in any one of claims 1 to 6 is implemented when at least one of the programs is executed by at least one of the processors.
9. A computer-readable storage medium, characterized in that, It stores a processor-executable computer program, which, when executed by the processor, is used to implement the data scheduling method for a distributed database as described in any one of claims 1 to 6.
10. A computer program product comprising computer programs or computer instructions, characterized in that, The computer program or the computer instructions are stored in a computer-readable storage medium. The processor of the electronic device reads the computer program or the computer instructions from the computer-readable storage medium and executes the computer program or the computer instructions, causing the electronic device to perform the data scheduling method for a distributed database as described in any one of claims 1 to 6.