Distributed event request processing method and device
By setting timestamp services independently for each tenant in a distributed database, the problems of distributed event sequence order and centralized service failure are solved, and efficient and accurate distributed event request processing is achieved.
Patent Information
- Application Number
- CN202411874271.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-18
- Publication Date
- 2025-04-15
AI Technical Summary
In a distributed database, due to the local time error of different nodes, it is difficult to correctly describe the order of distributed events, and the centralized timestamp service failure will affect the processing capability of the entire system.
Each tenant independently has its own timestamp service. The distributed event request processing method completes the event request operation by obtaining the tenant's timestamp information and the data in the target data shard, thereby realizing the ordering of distributed events.
Through distributed timestamp services, the impact of centralized service failure on the entire system is avoided, the success rate and accuracy of distributed event request processing is improved, and resource consumption and delay are reduced.
Smart Images

Figure CN119829677A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of artificial intelligence technology, in particular to the fields of distributed storage and cloud computing, and specifically to a distributed event request processing method and device. Background Art
[0002] There are many distributed events across nodes in distributed databases. Since the local time of different nodes has certain errors, relying solely on the local clock of a certain node is not enough to correctly describe the order of events. Accordingly, in order to ensure linear consistency, a certain mechanism is needed to sequence distributed events. Summary of the invention
[0003] The present disclosure provides a distributed event request processing method and device.
[0004] A distributed event request processing method, comprising:
[0005] Get distributed event requests;
[0006] Determine a target tenant corresponding to the distributed event request, and determine a target data shard corresponding to the distributed event request, wherein the target tenant data is stored in the target data shard;
[0007] Obtain the timestamp information corresponding to the distributed event request, and complete the operation corresponding to the distributed event request according to the timestamp information and the target tenant data. The timestamp information is obtained from the target timestamp service corresponding to the target tenant, and different tenants correspond to their own timestamp services.
[0008] A distributed event request processing method, comprising:
[0009] Sending a distributed event request to a target node, so that the target node completes the operation corresponding to the distributed event request according to the acquired timestamp information corresponding to the distributed event request and the target tenant data, wherein the timestamp information is acquired from a target timestamp service corresponding to the target tenant, and different tenants correspond to their own timestamp services respectively, and the target tenant is the tenant corresponding to the distributed event request, and the target tenant data is included in the target data shard corresponding to the distributed event request;
[0010] Obtain the response information returned by the target node after completing the operation.
[0011] A distributed event request processing device comprises: a request acquisition module, an information determination module and a request processing module;
[0012] The request acquisition module is used to acquire distributed event requests;
[0013] The information determination module is used to determine the target tenant corresponding to the distributed event request, and determine the target data shard corresponding to the distributed event request, wherein the target tenant data is stored in the target data shard;
[0014] The request processing module is used to obtain the timestamp information corresponding to the distributed event request, and complete the operation corresponding to the distributed event request according to the timestamp information and the target tenant data. The timestamp information is obtained from the target timestamp service corresponding to the target tenant, and different tenants correspond to their own timestamp services.
[0015] A distributed event request processing device comprises: a request sending module and a response obtaining module;
[0016] The request sending module is used to send a distributed event request to a target node, and the target node completes the operation corresponding to the distributed event request according to the acquired timestamp information corresponding to the distributed event request and the target tenant data, wherein the timestamp information is acquired from a target timestamp service corresponding to the target tenant, and different tenants correspond to their own timestamp services respectively. The target tenant is the tenant corresponding to the distributed event request, and the target tenant data is included in the target data shard corresponding to the distributed event request;
[0017] The response acquisition module is used to acquire the response information returned by the target node after completing the operation.
[0018] An electronic device, comprising:
[0019] at least one processor; and
[0020] a memory communicatively connected to the at least one processor; wherein,
[0021] The memory stores instructions that can be executed by the at least one processor. The instructions are executed by the at least one processor to enable the at least one processor to perform the method described above.
[0022] A non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause a computer to execute the method as described above.
[0023] A computer program product comprises a computer program / instruction, wherein the computer program / instruction implements the method described above when executed by a processor.
[0024] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.
[0026] Figure 1 This is a flowchart of the first embodiment of the distributed event request processing method disclosed in the present invention;
[0027] Figure 2 Schematic diagram of the implementation of traditional centralized TSO services;
[0028] Figure 3 This is a schematic diagram of an implementation method of the distributed TSO service described in the present disclosure;
[0029] Figure 4 A schematic diagram of basic data shards and extended data shards corresponding to the same tenant described in the present disclosure;
[0030] Figure 5 This is a flow chart of the second embodiment of the distributed event request processing method disclosed in the present invention;
[0031] Figure 6 This is a schematic diagram of the composition structure of the first embodiment 600 of the distributed event request processing device described in the present disclosure;
[0032] Figure 7 This is a schematic diagram of the structure of the second embodiment 700 of the distributed event request processing device described in the present disclosure;
[0033] Figure 8 A schematic block diagram of an electronic device 800 that can be used to implement an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0034] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0035] In addition, it should be understood that the term "and / or" in this article is only a description of the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.
[0036] Figure 1 FIG. 1 is a flow chart of the first embodiment of the distributed event request processing method disclosed in the present invention. Figure 1 As shown, the following specific implementation methods are included.
[0037] In step 101, a distributed event request is obtained, and a target tenant corresponding to the distributed event request is determined.
[0038] In step 102, a target data shard corresponding to the distributed event request is determined, and the target tenant data is stored in the target data shard.
[0039] In step 103, the timestamp information corresponding to the distributed event request is obtained, and the operation corresponding to the distributed event request is completed according to the timestamp information and the target tenant data. The timestamp information is obtained from the target timestamp (TSO, TimeStamp Oracle) service corresponding to the target tenant. Different tenants correspond to their own TSO services.
[0040] Traditionally, when processing distributed event requests, a centralized TSO service is usually used to sequence the distributed events.
[0041] Figure 2 This is a schematic diagram of the implementation of traditional centralized TSO services. Figure 2 As shown, the distributed database may include multiple nodes such as node 1 to node P, where P is a positive integer greater than 1. When a distributed event request needs to be sent to a target node (such as node P), the client (which may be any client corresponding to any tenant) may first request the corresponding timestamp information from the TSO service, and then add the obtained timestamp information to the distributed event request and send it to the target node, and obtain the response information returned by the target node after completing the operation corresponding to the distributed event request. The operation may include a write operation and a read operation.
[0042] pass Figure 2 The method shown can ensure that timestamp information is allocated in an incremental manner, thereby ensuring the timing of distributed events, and the implementation is relatively simple. However, in this method, only a single TSO service can provide timing (providing timestamp information) services, that is, a centralized TSO service is used. Once the TSO service fails, it will affect the entire system, such as causing subsequent distributed event requests to fail to be processed correctly.
[0043] And adopt Figure 1 In the scheme described in the embodiment of the method disclosed herein, each tenant can correspond to its own TSO service respectively. Accordingly, for the obtained distributed event request, the corresponding target tenant and the corresponding target data shard can be determined, and the corresponding timestamp information can be obtained from the TSO service corresponding to the target tenant, and then the operation corresponding to the distributed event request can be completed according to the obtained timestamp information and the target tenant data in the target data shard. That is to say, each tenant can independently start the corresponding TSO service, and each TSO service only provides timing service for the corresponding tenant, thereby splitting the original centralized TSO service according to the tenant level (for ease of expression, it can be called distributed TSO service), thereby avoiding the problem that the failure of the centralized TSO service will affect the entire system, and improving the success rate and accuracy of distributed event request processing.
[0044] A distributed database may include multiple nodes. In practical applications, Figure 1 The execution subject of the illustrated embodiment may be a target node, that is, a node corresponding to the distributed event request, and the client may send the distributed event request to the target node.
[0045] The distributed event request may carry various required information, and the specific information may be determined according to actual needs, such as tenant identification information. Accordingly, the target tenant corresponding to the distributed event request may be determined according to the tenant identification information.
[0046] In addition, for any tenant, each node usually only includes one data shard of the tenant. Accordingly, after determining the target tenant, the target data shard, that is, the data shard corresponding to the target tenant, can be determined, and the target tenant data is stored in the target data shard.
[0047] Each node can store data shards of multiple different tenants. In addition, the data between tenants is isolated from each other, and there are usually no distributed event requests across tenants.
[0048] Afterwards, the timestamp information corresponding to the distributed event request can be obtained, and the operation corresponding to the distributed event request can be completed according to the obtained timestamp information and the target tenant data. The timestamp information can be obtained from the target TSO service corresponding to the target tenant.
[0049] In some embodiments of the present disclosure, in response to determining that the target data shard is a basic data shard, timestamp information can be obtained according to a timestamp information acquisition method corresponding to the basic data shard, the basic data shard is located in a basic node, and the basic node is the first node used to store the target tenant data after the target tenant is created. In response to determining that the target data shard is an extended data shard, timestamp information can be obtained according to a timestamp information acquisition method corresponding to the extended data shard, the extended data shard is located in an extended node, and the extended node is a node used to store the target tenant data after the target tenant data exceeds the storage capacity of the basic data shard.
[0050] For the target tenant, after it is created, the target tenant data can be stored in the basic data shard in the specified basic node. If the target tenant data has always been small, then the basic data shard is sufficient to store the target tenant data. However, if the target tenant data increases subsequently and exceeds the storage capacity of the basic data shard, it is necessary to establish one or more extended data shards. Each extended data shard is located in an extended node, and each extended node and the basic node are different nodes.
[0051] In the scheme disclosed in the present invention, corresponding timestamp information acquisition methods can be used to obtain the required timestamp information according to whether the target data shard is a basic data shard or an extended data shard, thereby meeting the different usage requirements of tenants and enabling the required timestamp information to be correctly obtained in different situations, laying a good foundation for subsequent processing.
[0052] In some embodiments of the present disclosure, when acquiring the timestamp information according to the timestamp information acquisition method corresponding to the basic data slice, the timestamp information may be acquired from a target TSO service located in a basic node.
[0053] In other words, the target TSO service can be stored in the basic node, and the basic data shards are also stored in the basic node, so the timestamp information can be easily and quickly obtained locally, and then the corresponding operations of the distributed event request can be completed according to the obtained timestamp information and the target tenant data in the basic data shards, thereby improving the processing efficiency of the request.
[0054] In some embodiments of the present disclosure, the obtained distributed event request may be a distributed event request from a client. When obtaining timestamp information according to the timestamp information acquisition method corresponding to the extended data shard, the timestamp information can be obtained from the distributed event request. The timestamp information is obtained by the client from the target TSO service located in the base node and then added to the distributed event request.
[0055] That is, the client may first obtain the required timestamp information from the target TSO service in the base node, and then add the timestamp information to the distributed event request, and then send the distributed event request with the timestamp information added.
[0056] In addition, in some embodiments of the present disclosure, the basic data shard may include: a first sub-shard and a second sub-shard, the first sub-shard is used to store the target TSO service, and the second sub-shard is used to store the target tenant data. The extended data shard may only include the target tenant data.
[0057] By storing the target TSO service and the target tenant data together in the basic data shard, it is easier to manage and use the target TSO service.
[0058] Furthermore, in some embodiments of the present disclosure, the basic data shard and the extended data shard may correspond to M replicas respectively to form a replication group, where M is a positive integer greater than 1, one of the M replicas is a leader replica (Data Leader), and the other replicas among the M replicas except the leader replica are all follower replicas (Data Follower). The specific value of M may be determined according to actual needs.
[0059] By setting up multiple copies, the disaster recovery capability of the service can be improved. Under normal circumstances, the leading copy can provide services. If the leading copy has an abnormality, the follower copy can provide services.
[0060] Combined with the above introduction, Figure 3 Schematic diagram of the implementation of the distributed TSO service described in this disclosure. Figure 3 As shown, it is assumed that the distributed database includes 3 nodes (the numbers are only for illustrative purposes), namely node A, node B and node C, and it is assumed that there are 3 tenants, namely tenant A, tenant B and tenant C. Each tenant only has a corresponding basic data shard, and there is no corresponding extended data shard. It can be seen from the figure that each tenant can correspond to 3 copies, namely, the leader copy A and two follower copies A corresponding to tenant A, the leader copy B and two follower copies B corresponding to tenant B, and the leader copy C and two follower copies C corresponding to tenant C. Taking the leader copy A as an example, it may include a first sub-shard and a second sub-shard. The first sub-shard stores the TSO service of tenant A, and the second sub-shard stores the tenant data of tenant A.
[0061] Assuming that the target tenant corresponding to the obtained distributed event request is tenant A, and the corresponding target data shard is leader replica A, then the timestamp information can be directly obtained from the first sub-shard, and the operation corresponding to the distributed event request can be completed based on the obtained timestamp information and the tenant data of tenant A in the second sub-shard.
[0062] Figure 2 In the traditional method shown, the client needs to make two remote procedure calls (RPCs), one to obtain timestamp information from the centralized TSO service, and the other to add the obtained timestamp information to the distributed event request and then send the distributed event request. In most cases of the solutions described in the present disclosure, that is, Figure 3 In the case shown, the client only needs to perform one RPC, thereby reducing resource consumption and improving processing efficiency. Figure 2 The traditional method shown is prone to large delays. For example, if the centralized TSO service is located in Availability-Zone 1 (AZ1), and the client initiates a distributed event request in AZ2, then cross-AZ delays will be introduced. After adopting the solution described in the present disclosure, the TSO service at each tenant level is deployed nearby, thereby reducing cross-AZ situations and further reducing delays.
[0063] Figure 3 It is assumed that each tenant has only a corresponding basic data shard. In actual applications, the data volume of most tenants is relatively small, and the basic data shard can meet the storage requirements. However, some tenants have a large amount of data, which requires the use of one or more extended data shards.
[0064] Figure 4 Schematic diagram of the basic data shards and extended data shards corresponding to the same tenant described in this disclosure. Figure 4 As shown, assuming that node a is the basic node corresponding to tenant D, and node b is the extended node corresponding to tenant D, it can be seen that the basic node stores the basic data shard of tenant D, and the extended node stores the extended data shard of tenant D, wherein the basic data shard includes the first sub-shard and the second sub-shard, the first sub-shard stores the TSO service of tenant D, the second sub-shard stores the tenant data of tenant D, and the extended data shard can only store the tenant data of tenant D, which is equivalent to the extended data shard only including the second sub-shard. In addition, both the basic data shard and the extended data shard will correspond to M copies respectively. In order to simplify the drawings, not all copies are illustrated.
[0065] like Figure 4As shown, assuming that the target tenant corresponding to the obtained distributed event request is tenant D, and the corresponding target data shard is the extended data shard of tenant D, the client can first obtain the timestamp information from the TSO service corresponding to tenant D in node a, and then add the obtained timestamp information to the distributed event request and send it to node b. Node b can then obtain the timestamp information from the distributed event request, and complete the operation corresponding to the distributed event request according to the timestamp information and the tenant data in the extended data shard of tenant D.
[0066] The above mainly describes the solution of the present disclosure from the node side, and the following further describes the solution of the present disclosure from the client side.
[0067] Figure 5 FIG. 1 is a flow chart of the second embodiment of the distributed event request processing method described in the present disclosure. Figure 5 As shown, the following specific implementation methods are included.
[0068] In step 501, a distributed event request is sent to the target node, so that the target node completes the operation corresponding to the distributed event request according to the acquired timestamp information corresponding to the distributed event request and the target tenant data. The timestamp information is acquired from the target TSO service corresponding to the target tenant. Different tenants correspond to their own TSO services respectively. The target tenant is the tenant corresponding to the distributed event request, and the target tenant data is included in the target data shard corresponding to the distributed event request.
[0069] In step 502, the response information returned by the target node after completing the operation is obtained.
[0070] By adopting the scheme described in the above method embodiment, each tenant can correspond to its own TSO service respectively. Accordingly, for the obtained distributed event request, the corresponding target tenant and the corresponding target data shard can be determined, and the corresponding timestamp information can be obtained from the TSO service corresponding to the target tenant, and then the operation corresponding to the distributed event request can be completed according to the obtained timestamp information and the target tenant data in the target data shard. In other words, each tenant can independently start the corresponding TSO service, and each TSO service only provides timing service for the corresponding tenant, thereby splitting the original centralized TSO service according to the tenant level, thereby avoiding the problem that the failure of the centralized TSO service will affect the entire system, and improving the success rate and accuracy of distributed event request processing.
[0071] In practical applications, Figure 1 The execution subject of the illustrated embodiment may be a client.
[0072] In some embodiments of the present disclosure, a method for sending a distributed event request to a target node may include: in response to determining that the target node is a base node, sending a distributed event request without timestamp information to the target node, the base node is the first node used to store target tenant data after the target tenant is created, in response to determining that the target node is an extended node, obtaining timestamp information from the target TSO service in the base node, and sending the timestamp information to the target node in the distributed event request, and the extended node is a node used to store target tenant data after the target tenant data exceeds the storage capacity of the base data shard.
[0073] In the above processing method, different distributed event requests can be generated and sent according to whether the target node is a basic node or an extended node, so as to meet the different usage requirements of tenants.
[0074] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present disclosure is not limited by the described order of actions, because according to the present disclosure, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present disclosure. In addition, for parts that are not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.
[0075] The above is an introduction to the method embodiment. The following is a further explanation of the scheme disclosed in the present invention through an apparatus embodiment.
[0076] Figure 6 FIG. 6 is a schematic diagram of the structure of the first embodiment 600 of the distributed event request processing device described in the present disclosure. Figure 6 As shown, it includes: a request acquisition module 601, an information determination module 602 and a request processing module 603.
[0077] The request acquisition module 601 is used to acquire a distributed event request.
[0078] The information determination module 602 is used to determine the target data shard corresponding to the distributed event request, and the target tenant data is stored in the target data shard.
[0079] The request processing module 603 is used to obtain the timestamp information corresponding to the distributed event request, and complete the operation corresponding to the distributed event request according to the timestamp information and the target tenant data. The timestamp information is obtained from the target TSO service corresponding to the target tenant. Different tenants correspond to their own TSO services.
[0080] The distributed event request may carry various required information, and the specific information may be determined according to actual needs, such as tenant identification information. Accordingly, the information determination module 602 may determine the target tenant corresponding to the distributed event request according to the tenant identification information.
[0081] In addition, for any tenant, each node usually only includes one data shard of the tenant. Accordingly, after determining the target tenant, the information determination module 602 can determine the target data shard, that is, the data shard corresponding to the target tenant, and the target tenant data is stored in the target data shard.
[0082] The request processing module 603 can then obtain the timestamp information corresponding to the distributed event request, and can complete the operation corresponding to the distributed event request based on the obtained timestamp information and the target tenant data. The timestamp information can be obtained from the target TSO service corresponding to the target tenant.
[0083] In some embodiments of the present disclosure, in response to determining that the target data shard is a basic data shard, the request processing module 603 may obtain timestamp information according to a timestamp information acquisition method corresponding to the basic data shard, the basic data shard is located in a basic node, and the basic node is the first node used to store the target tenant data after the target tenant is created. In response to determining that the target data shard is an extended data shard, the request processing module 603 may obtain timestamp information according to a timestamp information acquisition method corresponding to the extended data shard, the extended data shard is located in an extended node, and the extended node is a node used to store the target tenant data after the target tenant data exceeds the storage capacity of the basic data shard.
[0084] In some embodiments of the present disclosure, when the request processing module 603 obtains the timestamp information in accordance with the timestamp information acquisition method corresponding to the basic data slice, it can obtain the timestamp information from the target TSO service located in the basic node.
[0085] In some embodiments of the present disclosure, the distributed event request obtained by the request acquisition module 601 may be a distributed event request from a client. When the request processing module 603 obtains the timestamp information according to the timestamp information acquisition method corresponding to the extended data shard, the timestamp information may be obtained from the distributed event request. The timestamp information is obtained by the client from the target TSO service located in the base node and then added to the distributed event request.
[0086] In addition, in some embodiments of the present disclosure, the basic data shard may include: a first sub-shard and a second sub-shard, the first sub-shard is used to store the target TSO service, and the second sub-shard is used to store the target tenant data. The extended data shard may only include the target tenant data.
[0087] Furthermore, in some embodiments of the present disclosure, the basic data shard and the extended data shard may correspond to M replicas respectively, where M is a positive integer greater than 1, one of the M replicas is a leader replica, and the other replicas among the M replicas except the leader replica are follower replicas.
[0088] Figure 7 FIG. 7 is a schematic diagram of the structure of the second embodiment 700 of the distributed event request processing device described in the present disclosure. Figure 7 As shown, it includes: a request sending module 701 and a response obtaining module 702.
[0089] The request sending module 701 is used to send a distributed event request to the target node, so that the target node completes the operation corresponding to the distributed event request according to the acquired timestamp information corresponding to the distributed event request and the target tenant data. The timestamp information is obtained from the target TSO service corresponding to the target tenant. Different tenants correspond to their own TSO services. The target tenant is the tenant corresponding to the distributed event request, and the target tenant data is included in the target data shard corresponding to the distributed event request.
[0090] The response acquisition module 702 is used to acquire the response information returned by the target node after completing the operation.
[0091] In some embodiments of the present disclosure, the way in which the request sending module 701 sends a distributed event request to the target node may include: in response to determining that the target node is a base node, sending a distributed event request without timestamp information to the target node, the base node is the first node used to store the target tenant data after the target tenant is created, in response to determining that the target node is an extended node, obtaining timestamp information from the target TSO service in the base node, and sending the timestamp information to the target node in the distributed event request, and the extended node is a node used to store the target tenant data after the target tenant data exceeds the storage capacity of the base data shard.
[0092] The specific working processes of the above-mentioned device embodiments can refer to the relevant descriptions in the above-mentioned method embodiments and will not be repeated here.
[0093] In summary, by adopting the solution described in the present disclosure, a tenant-level TSO service setting method can be adopted, thereby improving the success rate and accuracy of distributed event request processing, reducing resource consumption and latency, and improving processing efficiency.
[0094] The solution disclosed in the present disclosure can be applied to the field of artificial intelligence, especially to the fields of distributed storage and cloud computing. Artificial intelligence is a discipline that studies how computers can simulate certain human thought processes and intelligent behaviors (such as learning, reasoning, thinking, planning, etc.). It has both hardware-level and software-level technologies. Artificial intelligence hardware technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, and big data processing. Artificial intelligence software technologies mainly include computer vision technology, speech recognition technology, natural language processing technology, machine learning / deep learning, big data processing technology, knowledge graph technology, and other major directions.
[0095] The distributed event requests in the embodiments of this disclosure are not for a specific user and do not reflect the personal information of a specific user. In the technical solution of this disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good customs.
[0096] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
[0097] Figure 8 A schematic block diagram of an electronic device 800 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0098] like Figure 8 As shown, the electronic device 800 includes a computing unit 801, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 802 or a computer program loaded from a storage unit 808 to a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the electronic device 800 can also be stored. The computing unit 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0099] Multiple components in the electronic device 800 are connected to the I / O interface 805, including: an input unit 806, such as a keyboard, a mouse, etc.; an output unit 807, such as various types of displays, speakers, etc.; a storage unit 808, such as a disk, an optical disk, etc.; and a communication unit 809, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 809 allows the electronic device 800 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0100] The computing unit 801 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI, Artificial Intelligence) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSP, Digital Signal Processing), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 801 performs the various methods and processes described above, such as the methods described in the present disclosure. For example, in some embodiments, the methods described in the present disclosure may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 808. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 800 via the ROM 802 and / or the communication unit 809. When the computer program is loaded into the RAM 803 and executed by the computing unit 801, one or more steps of the methods described in the present disclosure may be executed. Alternatively, in other embodiments, the computing unit 801 may be configured to execute the method described in the present disclosure in any other appropriate manner (for example, by means of firmware).
[0101] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard parts (ASSPs), system on chip systems (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0102] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0103] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory, a read-only memory, an erasable programmable read-only memory (EPROM, Electronically Programmable Read-Only Memory), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM, Compact Disc Read-Only Memory), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0104] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a cathode ray tube (CRT) or a liquid crystal display (LCD) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or a trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0105] The systems and techniques described herein can be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected by digital data communication (e.g., a communication network) in any form or medium. Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0106] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.
[0107] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0108] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A distributed event request processing method, comprising: Get distributed event requests; Determine a target tenant corresponding to the distributed event request, and determine a target data shard corresponding to the distributed event request, wherein the target tenant data is stored in the target data shard; Obtain the timestamp information corresponding to the distributed event request, and complete the operation corresponding to the distributed event request according to the timestamp information and the target tenant data. The timestamp information is obtained from the target timestamp service corresponding to the target tenant, and different tenants correspond to their own timestamp services.
2. The method according to claim 1, wherein: The obtaining of the timestamp information corresponding to the distributed event request includes: In response to determining that the target data shard is a basic data shard, acquiring the timestamp information according to a timestamp information acquisition method corresponding to the basic data shard, the basic data shard is located in a basic node, and the basic node is the first node for storing the target tenant data after the target tenant is created; In response to determining that the target data shard is an extended data shard, the timestamp information is obtained according to the timestamp information acquisition method corresponding to the extended data shard, the extended data shard is located in an extended node, and the extended node is a node used to store the target tenant data after the target tenant data exceeds the storage capacity of the basic data shard.
3. The method according to claim 2, wherein: The acquiring of the timestamp information according to the timestamp information acquiring method corresponding to the basic data slice includes: acquiring the timestamp information from the target timestamp service located in the basic node.
4. The method according to claim 3, wherein: The obtaining of the distributed event request comprises: obtaining the distributed event request from the client; The acquiring of the timestamp information according to the timestamp information acquiring method corresponding to the extended data slice comprises: The timestamp information is obtained from the distributed event request, where the timestamp information is obtained by the client from the target timestamp service located in the base node and then added to the distributed event request.
5. The method according to claim 3, wherein: The basic data shard includes: a first sub-shard and a second sub-shard, the first sub-shard is used to store the target timestamp service, and the second sub-shard is used to store the target tenant data.
6. The method according to any one of claims 2 to 5, wherein: The basic data shard and the extended data shard correspond to M replicas respectively, where M is a positive integer greater than 1, one of the M replicas is a leader replica, and the other replicas among the M replicas except the leader replica are follower replicas.
7. A distributed event request processing method, comprising: Sending a distributed event request to a target node, so that the target node completes the operation corresponding to the distributed event request according to the acquired timestamp information corresponding to the distributed event request and the target tenant data, wherein the timestamp information is acquired from a target timestamp service corresponding to the target tenant, and different tenants correspond to their own timestamp services respectively, and the target tenant is the tenant corresponding to the distributed event request, and the target tenant data is included in the target data shard corresponding to the distributed event request; Obtain the response information returned by the target node after completing the operation.
8. The method according to claim 7, wherein: The sending of a distributed event request to a target node comprises: In response to determining that the target node is a base node, sending a distributed event request without the timestamp information to the target node, the base node being the first node for storing the target tenant data after the target tenant is created; In response to determining that the target node is an extended node, the timestamp information is obtained from the target timestamp service in the basic node, and the timestamp information is carried in the distributed event request and sent to the target node. The extended node is a node used to store the target tenant data after the target tenant data exceeds the storage capacity of the basic data shard.
9. A distributed event request processing device, comprising: Request acquisition module, information determination module and request processing module; The request acquisition module is used to acquire distributed event requests; The information determination module is used to determine the target tenant corresponding to the distributed event request, and determine the target data shard corresponding to the distributed event request, wherein the target tenant data is stored in the target data shard; The request processing module is used to obtain the timestamp information corresponding to the distributed event request, and complete the operation corresponding to the distributed event request according to the timestamp information and the target tenant data. The timestamp information is obtained from the target timestamp service corresponding to the target tenant, and different tenants correspond to their own timestamp services.
10. The device according to claim 9, wherein: In response to determining that the target data shard is a basic data shard, the request processing module obtains the timestamp information according to the timestamp information acquisition method corresponding to the basic data shard, the basic data shard is located in a basic node, and the basic node is the first node used to store the target tenant data after the target tenant is created; in response to determining that the target data shard is an extended data shard, the request processing module obtains the timestamp information according to the timestamp information acquisition method corresponding to the extended data shard, the extended data shard is located in an extended node, and the extended node is a node used to store the target tenant data after the target tenant data exceeds the storage capacity of the basic data shard.
11. The device according to claim 10, wherein: In response to determining that the target data shard is the base data shard, the request processing module obtains the timestamp information from the target timestamp service located in the base node.
12. The device according to claim 11, wherein: The request acquisition module acquires the distributed event request from the client; In response to determining that the target data shard is the extended data shard, the request processing module obtains the timestamp information from the distributed event request, where the timestamp information is obtained by the client from the target timestamp service located in the basic node and then added to the distributed event request.
13. The device according to claim 11, wherein: The basic data shard includes: a first sub-shard and a second sub-shard, the first sub-shard is used to store the target timestamp service, and the second sub-shard is used to store the target tenant data.
14. The device according to any one of claims 10 to 13, wherein: The basic data shard and the extended data shard correspond to M replicas respectively, where M is a positive integer greater than 1, one of the M replicas is a leader replica, and the other replicas among the M replicas except the leader replica are follower replicas.
15. A distributed event request processing device, comprising: Request sending module and response obtaining module; The request sending module is used to send a distributed event request to a target node, and the target node completes the operation corresponding to the distributed event request according to the acquired timestamp information corresponding to the distributed event request and the target tenant data, wherein the timestamp information is acquired from a target timestamp service corresponding to the target tenant, and different tenants correspond to their own timestamp services respectively. The target tenant is the tenant corresponding to the distributed event request, and the target tenant data is included in the target data shard corresponding to the distributed event request; The response acquisition module is used to acquire the response information returned by the target node after completing the operation.
16. The device according to claim 15, wherein: In response to determining that the target node is a base node, the request sending module sends a distributed event request without the timestamp information to the target node, the base node being the first node used to store the target tenant data after the target tenant is created, and in response to determining that the target node is an extended node, obtains the timestamp information from the target timestamp service in the base node, and sends the timestamp information to the target node by carrying it in the distributed event request, the extended node being a node used to store the target tenant data after the target tenant data exceeds the storage capacity of the base data shard.
17. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 8.
18. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to make a computer execute the method according to any one of claims 1 to 8.
19. A computer program product, comprising a computer program / instruction, wherein when the computer program / instruction is executed by a processor, the method according to any one of claims 1 to 8 is implemented.
Citation Information
Cited By
Logic timestamp obtaining and distributing method applied to distributed database
CN120448140A