A global minimum transaction ID determination method, device, equipment and storage medium
By receiving and processing transaction request requests and virtual transaction request requests, the global minimum transaction ID is determined, which solves the problem of the global minimum active transaction ID being too large in distributed databases, and improves the accuracy of the global minimum transaction ID and the accuracy of data visibility judgment.
Patent Information
- Application Number
- CN202210600887.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-30
- Publication Date
- 2025-11-25
- Estimated Expiration
- 2042-05-30
AI Technical Summary
In distributed databases, metadata nodes may overestimate the minimum active transaction ID when collecting data, leading to incorrect data visibility determinations.
By receiving transaction request and virtual transaction request from the server node, the transaction ID and virtual transaction ID are determined and sent to the server node to determine the minimum transaction ID. Finally, the metadata node determines the global minimum transaction ID.
This ensures the accuracy of the global minimum transaction ID, avoids misjudgments in data visibility determination, and improves the accuracy of data processing.
Smart Images

Figure CN114896030B_ABST
Abstract
Description
Technical Field
[0006] ,
[0005] , ,
[0001] The present invention relates to the field of computer technology, and in particular to a method, device, equipment and storage medium for determining a global minimum transaction ID. Background Art
[0002] For a distributed database, a metadata node is required to uniformly allocate transaction IDs to all server nodes to ensure the global uniqueness of transaction IDs, and the order of transaction startup can be determined according to the size of the transaction IDs. Since a transaction can span multiple server nodes or only involve some server nodes, when collecting the minimum active transaction ID, it is necessary to first count the minimum active transaction ID of each server node itself, and then further select the smallest one as the global active transaction ID. And if a server node has no active transaction, it does not participate in the collection of the minimum active transaction ID for that time. <00直线的斜率为007>The metadata node needs to periodically collect the minimum active transaction ID for optimizing the judgment of record visibility. For example, when transaction T1 starts, the current minimum active transaction ID is registered as Tm. Then, when T1 judges visibility, all transactions smaller than Tm must be visible to T1 because these transactions have ended before T1 starts.
[0004] However, the following problem of the collected global minimum active transaction ID being too large will occur in the following scenario: When both server node 1 and server node 2 have no active transactions and are applying for new transaction IDs from the metadata node, if the metadata node allocates transaction T1 and transaction T2 to server node 1 and server node 2 respectively and T1 < T2, and server node 2 receives the response message from the metadata node first and starts transaction T2. At this time, a global minimum active transaction ID collection action is initiated, and the minimum active transaction ID obtained from server node 1 is 0 (indicating no active transaction) and the minimum active transaction ID obtained from server node 2 is T2. The global minimum active transaction ID is statistically obtained as T2. Then, server node 3 starts transaction T3 and registers the current minimum active transaction ID equal to T2. At this time, server node 1 retrieves and starts transaction T1, and the data modified by it will be misjudged as visible by T3 because T1 has not been committed and cannot be seen by T3. [[ID=十六进制转十进制16]]Summary of the Invention <00000直线的斜率为02>The present invention provides a method, device, equipment and storage medium for determining a global minimum transaction ID, so as to solve the problem in the background art that when each server node collects its own minimum transaction ID, the transaction ID that has just been applied from the metadata node but has not been registered cannot be included in the statistics, resulting in the problem that the collected global minimum active transaction ID is too large, and can achieve the technical effect of ensuring that the metadata node collects an accurate global minimum transaction ID.
[0006] According to one aspect of the present invention, a method for determining the global minimum transaction ID is provided, the method comprising:
[0007] Receive at least one transaction request and virtual transaction request from a server node; the virtual transaction request is sent by the server node to the metadata node, requesting the metadata node to allocate the maximum transaction ID currently allocated by the metadata node to the server node;
[0008] The transaction ID is determined based on the transaction request, and the virtual transaction ID is determined based on the virtual transaction request.
[0009] The transaction ID and the virtual transaction ID are sent to the at least one server node, so that the at least one server node determines the minimum transaction ID based on the transaction ID or the virtual transaction ID;
[0010] The global minimum transaction ID is determined based on the minimum transaction ID sent by at least one server node.
[0011] According to another aspect of the present invention, a global minimum transaction ID determination apparatus is provided, the apparatus comprising:
[0012] The receiving module is used to receive transaction request requests and virtual transaction request requests sent by at least one server node; the virtual transaction request is sent by the server node to the metadata node, requesting the metadata node to allocate the maximum transaction ID currently allocated by the metadata node to the server node;
[0013] The first determining module is used to determine the transaction ID based on the transaction request and to determine the virtual transaction ID based on the virtual transaction request.
[0014] The sending module is configured to send the transaction ID and the virtual transaction ID to the at least one server node, so that the at least one server node determines the minimum transaction ID based on the transaction ID or the virtual transaction ID;
[0015] The second determining module is used to determine the global minimum transaction ID based on the minimum transaction ID sent by the at least one server node.
[0016] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0017] At least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores a computer program executable by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the global minimum transaction ID determination method according to any embodiment of the present invention.
[0018] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the global minimum transaction ID determination method according to any embodiment of the present invention.
[0019] The technical solution of this invention involves receiving transaction request requests and virtual transaction request requests from at least one server node, determining a transaction ID based on the transaction request, determining a virtual transaction ID based on the virtual transaction request, and sending the transaction ID and virtual transaction ID to at least one server node. This allows at least one server node to determine a minimum transaction ID based on either the transaction ID or the virtual transaction ID, and to determine a global minimum transaction ID based on the minimum transaction ID sent by at least one server node. By setting up a virtual transaction thread, this invention solves the problem in the background art where each server node, when collecting its own minimum transaction ID, cannot include transaction IDs that have just been requested from the metadata node but have not yet been registered in the statistics, thus resulting in an overly large global minimum active transaction ID. This achieves the technical effect of ensuring that the metadata node collects an accurate global minimum transaction ID.
[0020] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0021] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0022] Figure 1 This is a flowchart of a method for determining the global minimum transaction ID according to Embodiment 1 of the present invention;
[0023] Figure 2 This is a schematic diagram of a global minimum transaction ID determination device according to Embodiment 2 of the present invention;
[0024] Figure 3This is a schematic diagram of the structure of an electronic device that implements the global minimum transaction ID determination method of this invention. Detailed Implementation
[0025] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0026] It should be noted that the terms "first," "target," etc., in the specification, claims, and accompanying drawings of this invention 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 the invention described herein can be implemented 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 apparatus.
[0027] Example 1
[0028] Figure 1 This is a flowchart of a global minimum transaction ID determination method according to Embodiment 1 of the present invention. This embodiment is applicable to deterministic situations. The method can be executed by a global minimum transaction ID determination device, which can be implemented in hardware and / or software. This global minimum transaction ID determination device can be integrated into any electronic device that provides deterministic functionality. Figure 1 As shown, the method includes:
[0029] S101. Receive transaction request requests and virtual transaction request requests sent by at least one server node.
[0030] The virtual transaction request is sent by the server node to the metadata node, requesting the metadata node to allocate the maximum transaction ID currently allocated by the metadata node to the server node.
[0031] As we know, for a distributed database, there is a metadata node and multiple server nodes. The metadata node and all server nodes are connected through the network. The metadata node uniformly assigns transaction IDs to all server nodes to ensure the global uniqueness of the transaction IDs, and the order in which transactions are started can be determined based on the size of the transaction IDs.
[0032] It's important to explain that a transaction request can be sent from the server node to the metadata node, requesting the metadata node to allocate a transaction ID to the server node. Specifically, when the server node receives a request from the client, it initiates a transaction, at which point the server node sends a transaction request to the metadata node to obtain a transaction ID.
[0033] It should be noted that a virtual transaction request can be sent from a server node to a metadata node, requesting the metadata node to allocate the maximum transaction ID currently allocated by the metadata node to the server node. Specifically, each server node generates a virtual transaction and periodically sends a virtual transaction request to the metadata node to obtain the maximum transaction ID currently allocated by the metadata node.
[0034] Specifically, the metadata node receives transaction request requests and virtual transaction request requests from at least one server node via a network connection.
[0035] S102. Determine the transaction ID based on the transaction request, and determine the virtual transaction ID based on the virtual transaction request.
[0036] In this embodiment, each transaction corresponds to a transaction ID, which can be used to determine record visibility. The transaction ID is used to assign transactions within a server node, and the virtual transaction ID is used to assign virtual transactions within a server node. Preferably, the virtual transaction ID can be the largest transaction ID currently assigned to the metadata node.
[0037] Specifically, the metadata node determines the transaction ID based on the transaction request sent by the server node. The transaction ID can be the maximum transaction ID currently allocated to the metadata node plus 1. The metadata node determines the virtual transaction ID based on the virtual transaction request. The virtual transaction ID can be the maximum transaction ID currently allocated to the metadata node.
[0038] S103. Send the transaction ID and virtual transaction ID to at least one server node so that at least one server node can determine the minimum transaction ID based on the transaction ID or the virtual transaction ID.
[0039] It should be noted that the minimum transaction ID is the ID of the transaction with the smallest ID among the active transactions on the server node. That is, all transactions with IDs smaller than the minimum transaction ID on the server have ended, and these transactions are visible to transactions started after the minimum transaction ID is collected.
[0040] In practice, each server node uses a specific thread to request and register transaction IDs and virtual transaction IDs. This ensures that the registered transaction IDs are always less than the unregistered transaction IDs, thus guaranteeing the validity of the calculated minimum transaction ID. When a server node has not collected any active transactions, it needs to maintain the minimum transaction ID at the previous statistical value; otherwise, unregistered transaction IDs will be missed. Maintaining the minimum transaction ID, while conservative, ensures that this value is always less than the unregistered transaction IDs.
[0041] While this approach ensures the accuracy of the minimum transaction ID statistics, if a server node has no active transactions for an extended period, both its own minimum transaction ID and the global minimum transaction ID will fail to advance. This means that active transactions on other server nodes will consistently receive a smaller minimum transaction ID, significantly diminishing the effectiveness of using the minimum transaction ID to optimize visibility assessment. To address this issue, a virtual transaction is designed to periodically generate on each server node. This virtual transaction requests the currently allocated maximum transaction ID from the metadata node (but does not advance the transaction ID's growth) as its own transaction ID and participates in the minimum transaction ID statistics for that server node. Thus, even when a server node has no active transactions for an extended period, the virtual transaction's continuous requests for the maximum transaction ID will advance the minimum transaction ID's growth.
[0042] Specifically, the metadata node sends the transaction ID and the virtual transaction ID to at least one server node so that at least one server node can determine the minimum transaction ID based on the transaction ID or the virtual transaction ID.
[0043] S104. Determine the global minimum transaction ID based on the minimum transaction ID sent by at least one server node.
[0044] It should be noted that the global minimum transaction ID can be determined by the metadata node based on the minimum transaction IDs sent by all server nodes. The global minimum transaction ID can be collected periodically by the metadata node and can be used to determine record visibility.
[0045] Specifically, the metadata node determines the global minimum transaction ID from the minimum transaction IDs sent by at least one server node via a network connection.
[0046] The technical solution of this invention involves receiving transaction request requests and virtual transaction request requests from at least one server node, determining a transaction ID based on the transaction request, determining a virtual transaction ID based on the virtual transaction request, and sending the transaction ID and virtual transaction ID to at least one server node. This allows at least one server node to determine a minimum transaction ID based on either the transaction ID or the virtual transaction ID, and to determine a global minimum transaction ID based on the minimum transaction ID sent by at least one server node. By setting up a virtual transaction thread, this invention solves the problem in the background art where each server node, when collecting its own minimum transaction ID, cannot include transaction IDs that have just been requested from the metadata node but have not yet been registered in the statistics, thus resulting in an overly large global minimum active transaction ID. This achieves the technical effect of ensuring that the metadata node collects an accurate global minimum transaction ID.
[0047] Optionally, the virtual transaction ID is determined based on the virtual transaction request, including:
[0048] Get the currently allocated maximum transaction ID.
[0049] The currently allocated maximum transaction ID can be the maximum transaction ID that the metadata node has allocated to all server nodes.
[0050] Specifically, obtain the largest transaction ID among the transaction IDs that the metadata node has allocated to all server nodes.
[0051] The currently allocated maximum transaction ID is determined as the virtual transaction ID.
[0052] Specifically, the largest transaction ID among all transaction IDs allocated by the metadata node to all server nodes is designated as the virtual transaction ID. This is because when a server node has no active transactions for an extended period, both its own minimum transaction ID and the global minimum transaction ID cannot advance. Consequently, active transactions on other server nodes will consistently receive a smaller minimum transaction ID, significantly diminishing the effectiveness of using the minimum transaction ID to optimize visibility assessment. Therefore, by designating the largest transaction ID among all transaction IDs allocated by the metadata node to all server nodes as the virtual transaction ID and including it in the minimum transaction ID statistics for that server node, even when the server node is inactive, the minimum transaction ID will still grow due to virtual transactions continuously requesting the largest transaction ID.
[0053] Optionally, receiving a virtual transaction request sent by at least one server node includes:
[0054] If the server node does not collect transactions within the preset time, it will receive a virtual transaction request sent by the server node.
[0055] The preset time can be a time set in advance according to the actual situation, such as 1 second. This embodiment does not limit this.
[0056] In this embodiment, the target request sent by the client may be a request sent by the client to the server node to cause the server node to initiate a transaction.
[0057] Specifically, if the server node does not collect any transactions within a preset time, it sends a virtual transaction request to the metadata node. The metadata node receives the virtual transaction request sent by the server node and determines the virtual transaction ID based on the virtual transaction request.
[0058] Optionally, the minimum transaction ID is the virtual transaction ID.
[0059] Specifically, if a server node fails to collect any transactions within a preset time, the minimum transaction ID of that server node will be a virtual transaction ID.
[0060] Optionally, the global minimum transaction ID is determined based on the minimum transaction ID sent by at least one server node, including:
[0061] Obtain the status information of at least one server node.
[0062] It should be noted that the status information can be either a normal state or a fault state. A fault state can be a state where the network connection between the server node and the metadata node is broken, preventing communication between them.
[0063] Specifically, the metadata node detects whether the network connection between itself and each server node is broken, and determines the status information of all server nodes.
[0064] If the status information of the first target server node is in a fault state, then obtain the maximum transaction ID that the first target server node has applied for.
[0065] The first target server node can be a server node in a faulty state, that is, a server node whose network connection with the metadata node has been broken.
[0066] It should be explained that the maximum transaction ID requested by the first target server node can be the transaction ID registered by the metadata node when allocating a new non-virtual transaction ID to the first target server node.
[0067] In practice, when a server node fails, its minimum transaction ID will remain unchanged, preventing the global minimum transaction ID from advancing. To address this, it's necessary to first determine if there are any unfinished transactions on the failed server node. If so, the minimum transaction ID naturally cannot advance; however, if there are no unfinished transactions, the failed server node should no longer participate in the global minimum transaction ID calculation.
[0068] Specifically, if the status information of the first target server node is in a fault state, then the maximum transaction ID that the first target server node has applied for is obtained first, that is, the transaction ID registered by the metadata node when allocating a new non-virtual transaction ID to the first target server node.
[0069] If the maximum transaction ID requested by the first target server node is less than the minimum transaction ID reported by the first target server node, then the global minimum transaction ID is determined based on the minimum transaction ID sent by at least one of the server nodes other than the first target server node.
[0070] It should be noted that the minimum transaction ID reported by the first target server node can be the minimum transaction ID that the first target server node previously reported to the metadata node.
[0071] Specifically, the maximum transaction ID requested by the first target server node is compared with the minimum transaction ID reported by the first target server node. If the maximum transaction ID requested by the first target server node is less than the minimum transaction ID reported by the first target server node, it indicates that all transactions in the first target server node have been completed. In this round of global minimum transaction ID statistics, the first target server node can be skipped, and the global minimum transaction ID can be determined directly based on the minimum transaction ID sent by at least one other server node besides the first target server node.
[0072] Optionally, obtaining the status information of at least one server node includes:
[0073] If a network connection to the first target server node is detected to be broken, then the first target server node is determined to be faulty.
[0074] Specifically, the metadata node and the server node communicate via a network connection, and both the metadata node and the server node can detect whether the network connection between them is broken. In this embodiment, if the metadata node detects that the network connection with the first target server node is broken, it determines that the first target server node is faulty.
[0075] Optionally, the global minimum transaction ID is determined based on the minimum transaction ID sent by at least one server node, including:
[0076] Obtain the status information of at least one server node.
[0077] Specifically, the metadata node detects whether the network connection between itself and each server node is broken, and determines whether the status information of all server nodes is normal or faulty.
[0078] If the status information of the second target server node is in a fault state, then obtain the maximum transaction ID that the second target server node has applied for.
[0079] The second target server node can be a server node in a faulty state, that is, a server node whose network connection with the metadata node has been broken.
[0080] It should be explained that the maximum transaction ID requested by the second target server node can be the transaction ID registered by the metadata node when allocating a new non-virtual transaction ID to the second target server node.
[0081] In practice, when a server node fails, its minimum transaction ID will remain unchanged, preventing the global minimum transaction ID from advancing. To address this, it's necessary to first determine if there are any unfinished transactions on the failed server node. If so, the minimum transaction ID naturally cannot advance; however, if there are no unfinished transactions, the failed server node should no longer participate in the global minimum transaction ID calculation.
[0082] Specifically, if the metadata node detects a network connection loss with the second target server node, it determines that the second target server node is faulty. If the status information of the second target server node indicates a fault state, it first obtains the maximum transaction ID that the second target server node has requested, which is the transaction ID registered by the metadata node when allocating a new non-virtual transaction ID to the second target server node.
[0083] If the maximum transaction ID requested by the second target server node is greater than or equal to the minimum transaction ID reported by the second target server node, then the minimum transaction ID reported by the second target server node will be determined as the minimum transaction ID requested by the second target server node.
[0084] It should be noted that the minimum transaction ID reported by the second target server node can be the minimum transaction ID that the second target server node previously reported to the metadata node.
[0085] Specifically, the maximum transaction ID requested by the second target server node is compared with the minimum transaction ID reported by the second target server node. If the maximum transaction ID requested by the second target server node is greater than or equal to the minimum transaction ID reported by the second target server node, it indicates that there are still unfinished transactions in the second target server node, or that all transactions in the second target server node have been completed but the metadata node cannot determine this, therefore it cannot be determined that all transactions in the second target server node have been completed. In this round of global minimum transaction ID statistics, the minimum transaction ID reported by the second target server node can be determined as the minimum transaction ID requested by the second target server node in this round.
[0086] The global minimum transaction ID is determined based on the minimum transaction ID requested by the second target server node and the minimum transaction IDs sent by other server nodes besides the second target server node.
[0087] Specifically, the global minimum transaction ID is determined based on the minimum transaction ID requested by the second target server node and the minimum transaction IDs sent by other server nodes besides the second target server node. This ensures that the determination of the global minimum transaction ID will not be affected regardless of whether there are unfinished transactions on the failed server node.
[0088] The embodiments of the present invention can solve the problem of missing transaction IDs that have been applied for but not yet registered when server nodes collect minimum transaction IDs. It also solves the problem in the background technology that when each server node collects its own minimum transaction ID, it cannot include transaction IDs that have just been applied for from the metadata node but have not yet been registered in the statistics, thus resulting in the collection of global minimum active transaction IDs being too large. The present invention can achieve the technical effect of ensuring that the metadata node collects accurate global minimum transaction IDs.
[0089] Example 2
[0090] Figure 2 This is a schematic diagram of a global minimum transaction ID determination device provided according to Embodiment 2 of the present invention. Figure 2 As shown, the device includes: a receiving module 201, a first determining module 202, a sending module 203, and a second determining module 204.
[0091] The receiving module 201 is used to receive transaction request requests and virtual transaction request requests sent by at least one server node; the virtual transaction request is sent by the server node to the metadata node, requesting the metadata node to allocate the maximum transaction ID currently allocated by the metadata node to the server node.
[0092] The first determining module 202 is used to determine the transaction ID according to the transaction request and to determine the virtual transaction ID according to the virtual transaction request.
[0093] Sending module 203 is used to send the transaction ID and the virtual transaction ID to the at least one server node, so that the at least one server node determines the minimum transaction ID based on the transaction ID or the virtual transaction ID;
[0094] The second determining module 204 is used to determine the global minimum transaction ID based on the minimum transaction ID sent by the at least one server node.
[0095] Optionally, the first determining module 202 includes:
[0096] The first acquisition unit is used to acquire the currently allocated maximum transaction ID;
[0097] The first determining unit is used to determine the currently allocated maximum transaction ID as a virtual transaction ID.
[0098] Optionally, the receiving module 201 is specifically used for:
[0099] If the server node does not collect any transactions within a preset time, it will receive a virtual transaction request sent by the server node.
[0100] Optionally, the minimum transaction ID is the virtual transaction ID.
[0101] Optionally, the second determining module 204 includes:
[0102] The second acquisition unit is used to acquire the status information of the at least one server node;
[0103] The third acquisition unit is used to acquire the maximum transaction ID that the first target server node has applied for if the status information of the first target server node is in a fault state.
[0104] The second determining unit is configured to determine the global minimum transaction ID based on the minimum transaction ID sent by the other server nodes (excluding the first target server node) if the maximum transaction ID requested by the first target server node is less than the minimum transaction ID reported by the first target server node.
[0105] Optionally, the second acquisition unit is specifically used for:
[0106] If a network connection to the first target server node is detected to be broken, then the first target server node is determined to be faulty.
[0107] Optionally, the second determining module 204 includes:
[0108] The fourth acquisition unit is used to acquire the status information of the at least one server node;
[0109] The fifth acquisition unit is used to acquire the maximum transaction ID that the second target server node has applied for if the status information of the second target server node is in a fault state.
[0110] The third determining unit is configured to determine the minimum transaction ID reported by the second target server node as the minimum transaction ID that the second target server node has applied for if the maximum transaction ID applied for by the second target server node is greater than or equal to the minimum transaction ID reported by the second target server node.
[0111] The fourth determining unit is used to determine the global minimum transaction ID based on the minimum transaction ID requested by the second target server node and the minimum transaction IDs sent by other server nodes other than the second target server node.
[0112] The global minimum transaction ID determination device provided in the embodiments of the present invention can execute the global minimum transaction ID determination method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the method execution.
[0113] Example 3
[0114] Figure 3 A schematic diagram of an electronic device 30 that can be used to implement embodiments of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0115] like Figure 3As shown, the electronic device 30 includes at least one processor 31 and a memory, such as a read-only memory (ROM) 32 or a random access memory (RAM) 33, communicatively connected to the at least one processor 31. The memory stores computer programs executable by the at least one processor. The processor 31 can perform various appropriate actions and processes based on the computer program stored in the ROM 32 or loaded from storage unit 38 into the RAM 33. The RAM 33 can also store various programs and data required for the operation of the electronic device 30. The processor 31, ROM 32, and RAM 33 are interconnected via a bus 34. An input / output (I / O) interface 35 is also connected to the bus 34.
[0116] Multiple components in electronic device 30 are connected to I / O interface 35, including: input unit 36, such as keyboard, mouse, etc.; output unit 37, such as various types of monitors, speakers, etc.; storage unit 38, such as disk, optical disk, etc.; and communication unit 39, such as network card, modem, wireless transceiver, etc. Communication unit 39 allows electronic device 30 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0117] Processor 31 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 31 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 31 performs the various methods and processes described above, such as the global minimum transaction ID determination method:
[0118] Receive at least one transaction request and virtual transaction request from a server node; the virtual transaction request is sent by the server node to the metadata node, requesting the metadata node to allocate the maximum transaction ID currently allocated by the metadata node to the server node;
[0119] The transaction ID is determined based on the transaction request, and the virtual transaction ID is determined based on the virtual transaction request.
[0120] The transaction ID and the virtual transaction ID are sent to the at least one server node, so that the at least one server node determines the minimum transaction ID based on the transaction ID or the virtual transaction ID;
[0121] The global minimum transaction ID is determined based on the minimum transaction ID sent by at least one server node.
[0122] In some embodiments, the global minimum transaction ID determination method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 38. In some embodiments, part or all of the computer program may be loaded and / or mounted on electronic device 30 via ROM 32 and / or communication unit 39. When the computer program is loaded into RAM 33 and executed by processor 31, one or more steps of the global minimum transaction ID determination method described above may be performed. Alternatively, in other embodiments, processor 31 may be configured to perform the global minimum transaction ID determination method by any other suitable means (e.g., by means of firmware).
[0123] 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 products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0124] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0125] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0126] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, 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 sound input, voice input, or tactile input).
[0127] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0128] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0129] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0130] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A method for determining the global minimum transaction ID, characterized in that, include: Receive transaction request requests and virtual transaction request requests from at least one server node; The virtual transaction request is sent by the server node to the metadata node, requesting the metadata node to allocate the maximum transaction ID currently allocated by the metadata node to the server node; The transaction ID is determined based on the transaction request, and the virtual transaction ID is determined based on the virtual transaction request. The transaction ID and the virtual transaction ID are sent to the at least one server node, so that the at least one server node determines the minimum transaction ID based on the transaction ID or the virtual transaction ID; The global minimum transaction ID is determined based on the minimum transaction ID sent by at least one server node; The determination of the global minimum transaction ID based on the minimum transaction ID sent by the at least one server node includes: Obtain the status information of the at least one server node; If the status information of the first target server node is in a fault state, then obtain the maximum transaction ID that the first target server node has applied for; If the maximum transaction ID requested by the first target server node is less than the minimum transaction ID reported by the first target server node, then the global minimum transaction ID is determined based on the minimum transaction IDs sent by the other server nodes besides the first target server node.
2. The method according to claim 1, characterized in that, Determining the virtual transaction ID based on the virtual transaction request includes: Get the currently allocated maximum transaction ID; The currently allocated maximum transaction ID is determined as the virtual transaction ID.
3. The method according to claim 2, characterized in that, Receive virtual transaction request requests from at least one server node, including: If the server node does not collect any transactions within a preset time, it will receive a virtual transaction request sent by the server node.
4. The method according to claim 3, characterized in that, The minimum transaction ID is the virtual transaction ID.
5. The method according to claim 1, characterized in that, Obtaining the status information of the at least one server node includes: If a network connection to the first target server node is detected to be broken, then the first target server node is determined to be faulty.
6. The method according to claim 1, characterized in that, Determining the global minimum transaction ID based on the minimum transaction ID sent by at least one server node includes: Obtain the status information of the at least one server node; If the status information of the second target server node is in a fault state, then obtain the maximum transaction ID that the second target server node has applied for; If the maximum transaction ID requested by the second target server node is greater than or equal to the minimum transaction ID reported by the second target server node, then the minimum transaction ID reported by the second target server node is determined as the minimum transaction ID requested by the second target server node. The global minimum transaction ID is determined based on the minimum transaction ID requested by the second target server node and the minimum transaction IDs sent by other server nodes besides the second target server node.
7. A device for determining the global minimum transaction ID, characterized in that, include: The receiving module is used to receive transaction request requests and virtual transaction request requests sent by at least one server node; The virtual transaction request is sent by the server node to the metadata node, requesting the metadata node to allocate the maximum transaction ID currently allocated by the metadata node to the server node; The first determining module is used to determine the transaction ID based on the transaction request and to determine the virtual transaction ID based on the virtual transaction request. The sending module is configured to send the transaction ID and the virtual transaction ID to the at least one server node, so that the at least one server node determines the minimum transaction ID based on the transaction ID or the virtual transaction ID; The second determining module is used to determine the global minimum transaction ID based on the minimum transaction ID sent by the at least one server node; The second determining module includes: The second acquisition unit is used to acquire the status information of the at least one server node; The third acquisition unit is used to acquire the maximum transaction ID that the first target server node has applied for if the status information of the first target server node is in a fault state. The second determining unit is configured to determine the global minimum transaction ID based on the minimum transaction ID sent by the other server nodes (excluding the first target server node) if the maximum transaction ID requested by the first target server node is less than the minimum transaction ID reported by the first target server node.
8. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the global minimum transaction ID determination method according to any one of claims 1-6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the global minimum transaction ID determination method according to any one of claims 1-6.
Citation Information
Patent Citations
Transaction execution method and device, computer equipment and storage medium
CN111143389A
Data management method and device, electronic equipment and computer readable storage medium
CN113422790A