Method, device and storage medium for accessing a data table

By assigning unique transaction identifiers to the backup node's access operations, the problem of access errors when the backup node accesses the storage layer data table in the storage-compute separation architecture is solved, thus ensuring the correctness and reliability of data table access.

CN116166699BActive Publication Date: 2026-06-02SHENZHEN HUAWEI CLOUD COMPUTING TECHNOLOGIES CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHENZHEN HUAWEI CLOUD COMPUTING TECHNOLOGIES CO LTD
Filing Date
2023-02-01
Publication Date
2026-06-02

AI Technical Summary

Technical Problem

In a storage-compute separation architecture, backup nodes may encounter access errors when accessing data tables in the storage layer, especially intermediate data reading problems caused by conflicts in transaction identifiers.

Method used

The standby node assigns a unique transaction identifier to each access operation and isolates its own access operations from those of the master node through the transaction identifier, thus avoiding direct access to the master node's intermediate data.

Benefits of technology

By isolating transaction identifiers, access errors are avoided, ensuring the correctness and reliability of data table access and preventing backup node failures.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116166699B_ABST
    Figure CN116166699B_ABST
Patent Text Reader

Abstract

The application discloses a method, device and storage medium for accessing a data table, and belongs to the computer field. The method comprises the following steps: a backup node receives an access request, wherein the access request is used for indicating a first access operation for a first data table, and the first data table is a temporary table in the backup node; the backup node allocates a first transaction identifier for the first access operation, wherein the first transaction identifier is different from a second transaction identifier of a second access operation which is being executed by a master node corresponding to the backup node, the second access operation is used for accessing a second data table, and the second data table is a data table which is saved persistently in a storage layer; and the backup node accesses the first data table through the first access operation based on the first transaction identifier. The application can avoid access errors.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computers, and in particular to a method, apparatus and storage medium for accessing data tables. Background Technology

[0002] Cloud data services can adopt a compute-storage separation architecture, which includes a compute layer and a storage layer. The compute layer includes multiple compute nodes, and the storage layer includes data tables that are persistently stored in the storage layer. The multiple compute nodes include a primary node and at least one backup node. The primary node can read and write the data tables in the storage layer, and the backup node can read the data tables in the storage layer.

[0003] The standby node may include temporary tables, which it can read and write. For example, the standby node can read data from a data table in the storage layer and write that data to the temporary table. During the process of the primary node reading and writing data to the data table in the storage layer, the primary node can store intermediate data generated during this process in that data table. However, the standby node might try to read this intermediate data when accessing the data table, resulting in an access error. Summary of the Invention

[0004] This application provides a method, apparatus, and storage medium for accessing data tables to avoid access errors. The technical solution is as follows:

[0005] In one aspect, this application provides a method for accessing a data table. In this method, a standby node receives an access request indicating a first access operation for a first data table, which is a temporary table within the standby node. The standby node assigns a first transaction identifier to the first access operation. This first transaction identifier differs from the second transaction identifier of a second access operation being executed by the primary node corresponding to the standby node. This second access operation accesses a second data table, which is a data table persistently stored in the storage layer. The standby node accesses the first data table through the first access operation based on the first transaction identifier.

[0006] In this process, the primary node accesses the second data table using a second access operation based on a second transaction identifier, while the backup node accesses the first data table using a first access operation based on a first transaction identifier. During the process of accessing the first data table using the first access operation, the backup node may access the second data table located in the storage layer. Because the first and second transaction identifiers are different, the backup node will not access the data obtained by the primary node during the second access operation stored in the second data table. This effectively isolates the first and second access operations through the first and second transaction identifiers, preventing access errors.

[0007] In one possible implementation, the backup node uses a transaction identifier from a first identifier range as the first transaction identifier and assigns it to the first access operation. Since there is no overlap between the first identifier range and the second identifier range, the transaction identifiers included in the second identifier range are those that can be assigned to access operations executed by the master node, thus ensuring that the first transaction identifier and the second transaction identifier are different.

[0008] In another possible implementation, the lower limit of the second identifier range is greater than the upper limit of the first identifier range, thereby ensuring that the first transaction identifier and the second transaction identifier are different when allocating the first transaction identifier for the first access operation from the first identifier range.

[0009] In another possible implementation, the access request includes first identification information of the first data table. The backup node accesses the first data table through a first access operation based on the first identification information and the first transaction identifier. In this way, the first data table is identified through the first identification information, ensuring that the first data table can be successfully accessed through the first access operation.

[0010] In another possible implementation, the backup node assigns first identification information to the first data table. This first identification information is different from the identification information of each data table included in the storage layer. In this way, the first data table can be identified through the first identification information, thus avoiding access errors.

[0011] In another possible implementation, the backup node uses one of the identifiers from the third identifier range as the first identifier and assigns the first identifier to the first data table. Since there is no overlap between the third identifier range and the fourth identifier range containing the identifiers of each data table, and the identifiers included in the fourth identifier range are identifiers that can be assigned to data tables persistently stored in the storage layer, this ensures that the first identifier is different from the identifiers of each data table included in the storage layer.

[0012] In another possible implementation, the backup node obtains the first index identifier of the index corresponding to the first data table based on the first identification information. This index is used to store the identification information and storage location of each piece of data in the first data table. The backup node obtains the index based on the first index identifier. Based on the first transaction identifier and the index, the backup node accesses the first data table through a first access operation. Since the index is used to store the identification information and storage location of each piece of data in the first data table, the efficiency of accessing the first data table can be improved based on this index.

[0013] In another possible implementation, the backup node assigns a first index identifier to the index corresponding to the first data table. The first index identifier is different from the index identifier of the index corresponding to each data table included in the storage layer. In this way, the index corresponding to the first data table can be determined by the first index identifier, thus avoiding access errors.

[0014] Secondly, this application provides an apparatus for accessing a data table, used to perform the method in the first aspect or any possible implementation thereof. Specifically, the apparatus includes units for performing the method in the first aspect or any possible implementation thereof.

[0015] Thirdly, this application provides an apparatus for accessing a data table, including at least one processor and a memory, wherein the at least one processor is configured to be coupled to the memory, read and execute instructions in the memory to implement the method in the first aspect or any possible implementation of the first aspect.

[0016] Fourthly, this application provides a computer program product comprising a computer program stored in a computer-readable storage medium, wherein the computer program is loaded by a processor to implement the method described in the first aspect or any possible implementation thereof.

[0017] Fifthly, this application provides a computer-readable storage medium for storing a computer program, which is loaded by a processor to execute the method described in the first aspect or any possible implementation thereof.

[0018] In a sixth aspect, this application provides a chip including a memory and a processor, wherein the memory is used to store computer instructions, and the processor is used to retrieve and execute the computer instructions from the memory to perform the method described in the first aspect or any possible implementation thereof. Attached Figure Description

[0019] Figure 1 This is a schematic diagram of a cloud service architecture provided in an embodiment of this application;

[0020] Figure 2 This is a schematic diagram of another cloud service architecture provided in the embodiments of this application;

[0021] Figure 3 This is a flowchart of a method for accessing a data table provided in an embodiment of this application;

[0022] Figure 4 This is a flowchart of a method for allocating identifiers provided in an embodiment of this application;

[0023] Figure 5This is a flowchart of another method for allocating identifiers provided in an embodiment of this application;

[0024] Figure 6 This is a schematic diagram of a device structure for accessing a data table provided in an embodiment of this application;

[0025] Figure 7 This is a schematic diagram of the structure of a computing device provided in an embodiment of this application;

[0026] Figure 8 This is a schematic diagram of the structure of a computing device cluster provided in an embodiment of this application;

[0027] Figure 9 This is a schematic diagram of another computing device cluster structure provided in an embodiment of this application. Detailed Implementation

[0028] The embodiments of this application will now be described in further detail with reference to the accompanying drawings.

[0029] See Figure 1 This application provides a cloud service architecture 100, which can be divided into two layers: a computing layer and a storage layer. The computing layer is responsible for data computation, and the storage layer is responsible for data storage. That is, the cloud service architecture 100 is a storage-computing separation architecture.

[0030] The computing layer includes multiple computing nodes, including a master node 101 and at least one backup node 102. The master node 101 communicates with each of the at least one backup node 102, which is used to back up the master node 101.

[0031] The storage layer includes at least one storage node 103, each of which is used to store data, which may be data written by the master node 101.

[0032] The primary node 101 can read and write at least one storage node 103 included in the storage layer. Each backup node 102 is a read-only node, which can read data stored in at least one storage node 103 included in the storage layer, but cannot write data to at least one storage node 103 included in the storage layer.

[0033] In some embodiments, the storage layer includes at least one data table, which is persistently stored on the at least one storage node 103. The primary node 101 reading and writing the at least one storage node 103 means that the primary node 101 reads and writes the at least one data table. The backup node 102 reading data stored in the at least one storage node 103 included in the storage layer means that the backup node 102 reads data stored in the at least one data table.

[0034] For any standby node 102, its memory may store a temporary table, which can be read and written. Similarly, the master node 101 may also store a temporary table, which can be read and written. The temporary tables in both standby node 102 and master node 101 are data tables that do not require persistent storage.

[0035] If a terminal device needs to write data to a data table in the storage layer, it can send a write request to the master node 101, causing the master node 101 to write the data to the data table in the storage layer. If a terminal device needs to read data stored in a data table in the storage layer, it can send a read request to the master node 101 or the backup node 102, causing the master node 101 or the backup node 102 to read the data from the data table in the storage layer.

[0036] See Figure 2 For any backup node 102, the backup node 102 can establish a first session connection with the first terminal device 104, and the first terminal device 104 communicates with the backup node 102 through the first session connection.

[0037] Specifically, when establishing the first session connection, the backup node 102 can create a temporary table for the first session connection. This temporary table is located in the memory of the backup node 102 and is referred to as the first data table for ease of explanation. The backup node 102 destroys the first data table when the first session connection is closed.

[0038] During the duration of the first session connection, the first data table exists in the memory of the backup node 102. The first data table is used to store data related to the first session connection.

[0039] For example, the first terminal device 104 sends a first access request to the backup node 102 through a first session connection. The first access request is used to indicate a first access operation, which may include a read operation and / or a write operation, etc. The first access operation is used to read and write a first data table located in the backup node 102.

[0040] In the process of reading and writing the first data table using the first access operation, the backup node 102 may use the first access operation to read the second data table located in the storage layer, and the at least one data table located in the storage layer includes the second data table.

[0041] When the first access operation includes a read operation, the backup node 102 may read data from the second data table and write the read data into the first data table. Then, it processes the data cached in the first data table and sends the processing result to the first terminal device 104 through the first session connection, or it sends the data cached in the first data table to the first terminal device 104 through the first session connection.

[0042] When the first access operation includes a write operation, the first access request may include data to be written. The backup node 102 may write the data to be written included in the first access request into the first data table.

[0043] In some embodiments, after receiving a first access request, the backup node 102 needs to assign a first transaction identifier to the first access operation indicated by the first access request. The backup node 102 needs to use the first transaction identifier when performing the first access operation.

[0044] See Figure 2 The master node 101 can establish a second session connection with the second terminal device 105, and the second terminal device 105 communicates with the master node 101 through the second session connection.

[0045] When establishing a second session connection, the master node 101 can create a temporary table for that connection. This temporary table resides in the memory of the master node 101 and is referred to as the third data table for ease of explanation. The master node 101 destroys the third data table when the second session connection is closed.

[0046] During the duration of the second session connection, the third data table exists in the memory of the master node 101. The third data table is used to store data related to the second session connection.

[0047] For example, the second terminal device 105 sends a second access request to the master node 101 through a second session connection. The second access request is used to indicate a second access operation, which may include read operations and / or write operations, etc. The second access operation is used to access a second data table located in the storage layer.

[0048] When the second access operation includes a read operation, the master node 101 may read data from the second data table in the storage layer and write the read data into the third data table. Then, it processes the data cached in the third data table and sends the processing result to the second terminal device 105 through the second session connection, or it sends the data cached in the third data table to the second terminal device 105 through the second session connection.

[0049] When the second access operation is a write operation, the second access request may include data to be written. The master node 101 may write the data to be written included in the second access request to a third data table. Then, it processes the data cached in the third data table and writes the processing result to the second data table in the storage layer, or writes the cached data from the third data table to the second data table in the storage layer.

[0050] In some embodiments, after receiving a second access request, the master node 101 needs to assign a second transaction identifier to the second access operation indicated by the second access request. The master node 101 needs to use the second transaction identifier when performing the second access operation.

[0051] The storage layer stores the transaction identifier previously allocated by the master node 101. For ease of explanation, this transaction identifier stored in the storage layer is referred to as the third transaction identifier. When the master node 101 allocates a transaction identifier for the second access operation indicated by the second access request, it increments the third transaction identifier to obtain the second transaction identifier and then allocates the second transaction identifier to the second access operation. After obtaining the second transaction identifier, the master node 101 may also update the third transaction identifier stored in the storage layer to the second transaction identifier.

[0052] In some embodiments, the storage layer includes a public area for storing third transaction identifiers.

[0053] The backup node 102 may assign a first transaction identifier to the first access operation in the same way that the primary node 101 assigns transaction identifiers. That is, when assigning a first transaction identifier to the first access operation indicated by the first access request, the backup node 102 increments the transaction identifier stored in the storage layer to obtain the first transaction identifier, and then assigns the first transaction identifier to the first access operation. After obtaining the first transaction identifier, the backup node 102 may also update the transaction identifier stored in the storage layer to the first transaction identifier.

[0054] The following two issues may arise when the backup node 102 allocates the first transaction identifier:

[0055] Question 1: After the primary node 101 adds a third transaction identifier to obtain a second transaction identifier and before updating the third transaction identifier stored in the storage layer to the second transaction identifier, the backup node 102 reads the third transaction identifier from the common area of ​​the storage layer, adds the third transaction identifier to obtain a second transaction identifier (i.e., the first transaction identifier and the second transaction identifier are the same), and assigns the second transaction identifier to the first access operation. Thus, the transaction identifier of the first access operation is the same as the transaction identifier of the second access operation, making it impossible to isolate the first access operation and the second access operation through the transaction identifier, resulting in an access error.

[0056] For example, when the master node 101 executes the second access operation, it may generate intermediate data. The second transaction identifier of the second access operation and this intermediate data are stored in a second data table in the storage layer. Before the master node 101 completes the second access operation, this intermediate data stored in the second data table can be read or modified by the second access operation. That is, the master node 101 can access the intermediate data stored in the second data table based on the second transaction identifier, but other nodes cannot access this intermediate data stored in the second data table.

[0057] However, since the transaction identifier assigned to the backup node 102 for the first access operation is also the second transaction identifier, the backup node 102 can read the intermediate data from the second data table based on the second transaction identifier during the execution of the first access operation. Thus, the first access operation and the second access operation cannot be isolated by the second transaction identifier, resulting in an access error.

[0058] Question 2: Since the backup node 102 is a read-only node, it will crash after updating the transaction identifier stored in the public area of ​​the storage layer to the first transaction identifier, just like the primary node 101, once it obtains the first transaction identifier.

[0059] To address the two issues that may arise when the backup node 102 accesses the first data table using the first access operation, the backup node 102 may access the data table using any of the following embodiments.

[0060] See Figure 3 This application provides a method 300 for accessing a data table, the method 300 being applied to... Figure 1 or Figure 2 The cloud service architecture 100 shown includes the following steps 301 to 303 in the method 300.

[0061] Step 301: The first backup node receives the first access request, which is used to indicate the first access operation for the first data table, which is a temporary table in the first backup node.

[0062] The cloud service architecture 100 includes a primary node and at least one backup node, wherein the first backup node is any one of the at least one backup nodes.

[0063] In step 301, the first backup node receives a first access request sent by the first terminal device through a first session connection. The first session connection is a session connection between the first terminal device and the first backup node. The first access request includes first identification information, which is the identification information of the first data table.

[0064] Before executing step 301, a first session connection is established between the first backup node and the first terminal device. During the establishment of the first session connection, the first backup node also creates a temporary table for the first session connection; for ease of explanation, this temporary table is referred to as the first data table, and the first data table resides in the memory of the first backup node. The detailed implementation process of creating the first data table will be discussed later. Figure 4 The illustrated embodiments will be used for explanation, but will not be described in detail here.

[0065] The data stored in the first data table is related to the first session connection. When the first session connection is disconnected, the first backup node will destroy the first data table.

[0066] The first terminal device sends at least one access request to the first backup node through a first session connection. Each access request includes a first access request, and each access request corresponds one-to-one with at least one access operation. A first data table is used to store data acquired by the first backup node during the execution of at least one access operation.

[0067] In some embodiments, the first access request includes a read request, and optionally, the first access request also includes identification information of the data to be read.

[0068] In some embodiments, the first access request includes a write request, which includes data to be written.

[0069] In some embodiments, the first access request includes a processing request for requesting data processing.

[0070] The master node may receive a second access request, which is used to indicate a second access operation for a second data table, which is a data table stored in the storage layer.

[0071] The master node receives a second access request sent by the second terminal device through a second session connection. The second session connection is a session connection between the second terminal device and the master node. The second access request includes second identification information, which is the identification information of the second data table.

[0072] Before the master node receives the second access request, a second session connection is established between the master node and the second terminal device. During the establishment of the second session connection, the master node also creates a temporary table for the second session connection; for ease of explanation, this temporary table will be referred to as the third data table, which resides in the master node's memory. The second data table is also created by the master node; the detailed implementation process of creating the second and third data tables will be discussed later. Figure 5 The illustrated embodiments will be used for explanation, but will not be described in detail here.

[0073] The data stored in the third data table is related to the second session connection. When the second session connection is disconnected, the master node will destroy the third data table.

[0074] The second terminal device sends at least one access request to the master node through a second session connection. This at least one access request includes a second access request, and each access request corresponds one-to-one with at least one access operation used to access a second data table. A third data table is used to store data acquired by the master node during the execution of at least one access operation; that is, the third data table stores data acquired by the master node during the access to the second data table.

[0075] In some embodiments, the second access request includes a read request, and optionally, the second access request also includes identification information of the data to be read.

[0076] In some embodiments, the second access request includes a write request, which includes data to be written.

[0077] In some embodiments, the second access request includes a processing request for requesting data processing.

[0078] Step 302: The first standby node assigns a first transaction identifier to the first access operation indicated by the first access request. The first transaction identifier is different from the second transaction identifier of the second access operation being executed by the primary node. The second access operation is used to access the second data table.

[0079] In step 302, the first standby node selects a transaction identifier from the first identifier range as the first transaction identifier and assigns the first transaction identifier to the first access operation indicated by the first access request. The first identifier range and the second identifier range containing the second transaction identifier do not overlap, and the transaction identifiers included in the second identifier range are those that can be assigned to access operations executed by the master node.

[0080] In some embodiments, the first backup node includes a first memory counter, which is used to record the most recently allocated transaction identifier of the first backup node.

[0081] If the transaction identifier recorded by the first memory counter is not the upper limit of the first identifier range, the first backup node increments the first memory counter to obtain the first transaction identifier, and assigns the first transaction identifier to the first access operation indicated by the first access request. Optionally, the first backup node increments the first memory counter by 1, and uses the incremented first memory counter value as the first transaction identifier.

[0082] If the transaction identifier recorded by the first memory counter is the upper limit of the first identifier range, the first backup node uses the lower limit of the first identifier range as the first transaction identifier, assigns the first transaction identifier to the first access operation indicated by the first access request, and sets the value counted by the first memory counter as the first transaction identifier.

[0083] In some embodiments, the first identifier range may include a transaction identifier, which the first backup node assigns to the access operation indicated by the received access request each time it receives an access request. That is, the first backup node assigns a fixed transaction identifier to each access operation.

[0084] When the master node receives the second access request, it selects a transaction identifier from the second identifier range as the second transaction identifier and assigns the second transaction identifier to the second access operation.

[0085] In some embodiments, the master node includes a second memory counter, which is used to record the most recently allocated transaction identifier of the master node.

[0086] If the transaction identifier recorded by the second memory counter is not the upper limit of the second identifier range, the master node increments the second memory counter to obtain the second transaction identifier and assigns the second transaction identifier to the second access operation indicated by the second access request. Optionally, the master node increments the second memory counter by 1 and uses the incremented value as the second transaction identifier.

[0087] If the transaction identifier recorded by the second memory counter is the upper limit of the second identifier range, the master node uses the lower limit of the second identifier range as the second transaction identifier, assigns the second transaction identifier to the second access operation indicated by the second access request, and sets the value counted by the second memory counter as the second transaction identifier.

[0088] Typically, the upper limit of the second identifier range is relatively large, which ensures that the transaction identifier recorded by the second memory counter is less than the upper limit of the second identifier range.

[0089] In some embodiments, two transaction identifier ranges are pre-defined: a first identifier range and a second identifier range. Any standby node can select a transaction identifier from the first identifier range and assign it to an access operation to be executed by that standby node. The primary node can select a transaction identifier from the second identifier range and assign it to an access operation to be executed by that primary node. The first and second identifier ranges do not overlap, ensuring that the transaction identifier for an access operation executed by the standby node is different from that executed by the primary node. This transaction identifier isolates the access operations executed by the standby node and the primary node, preventing access errors.

[0090] In some embodiments, the lower limit of the second identification range is greater than the upper limit of the first identification range.

[0091] In some embodiments, the common area of ​​the storage layer stores the transaction identifier previously allocated by the master node. After receiving the second transaction identifier, the master node updates the transaction identifier stored in the common area to the second transaction identifier. However, after receiving the first transaction identifier, the first standby node does not update the transaction identifier stored in the common area to the first transaction identifier, thus preventing the first standby node from crashing.

[0092] Step 303: The first backup node accesses the first data table through the first access operation based on the first transaction identifier.

[0093] In step 303, the first backup node accesses the first data table through a first access operation based on the first identification information and the first transaction identifier. Optionally, the first backup node determines the first data table based on the first identification information, acquires data during the execution of the first access operation, and stores the correspondence between the first transaction identifier and the data in the first data table.

[0094] In some embodiments, the first access request includes a read request, and the first access operation includes a read operation. The first backup node can read data from the second data table based on the first access operation and store the first transaction identifier and the corresponding data in the first data table. Then, the first backup node sends the data stored in the first data table to the first terminal device. Alternatively, if the first access request includes a processing request, the backup node processes the data stored in the first data table based on the processing request to obtain a processing result, and sends the processing result to the first terminal device.

[0095] Optionally, the first access request includes identification information of the data to be read. The first backup node reads the data corresponding to the identification information from the second data table and saves the first transaction identifier and the corresponding data into the first data table.

[0096] In some embodiments, the first access request includes a write request, the first access operation includes a write operation, and the first access request includes data to be written. The first backup node stores a first transaction identifier and the data to be written in a first data table. The first access request includes a processing request, and the first backup node can process the data to be written stored in the first data table based on the processing request.

[0097] The master node can access the second data table through a second access operation based on the second transaction identifier. Optionally, the master node can also access the third data table through a second access operation based on the second transaction identifier.

[0098] In implementation, the master node accesses the second data table through a second access operation based on the second identifier information and the second transaction identifier. Optionally, the master node determines the second data table based on the second identifier information, acquires data during the execution of the second access operation, and stores the correspondence between the second transaction identifier and the data in the second data table or a third data table.

[0099] In some embodiments, the second access request includes a read request, and the second access operation includes a read operation. The master node can read data from the second data table based on the second access operation and store the second transaction identifier and the corresponding data in a third data table. Then, the master node sends the data stored in the second data table to the second terminal device. Alternatively, the second access request may include a processing request, and the master node processes the data stored in the second data table based on the processing request to obtain a processing result, which is then sent to the second terminal device.

[0100] Optionally, the second access request includes identification information of the data to be read. The master node reads the data corresponding to the identification information from the second data table and saves the second transaction identifier and the corresponding data into the second data table.

[0101] In some embodiments, the second access request includes a write request, the second access operation includes a write operation, and the second access request includes data to be written. The master node stores the second transaction identifier and the data to be written in a third data table. Then, the master node can process the data to be written stored in the third data table, obtain the processing result, and store the correspondence between the second transaction identifier and the processing result in the second data table; or, the master node can read the second transaction identifier and the data to be written from the third data table, and then save the second transaction identifier and the data to be written to the second data table.

[0102] The first standby node obtains the transaction identifier of the access operation being performed by the primary node from the primary node. When the first standby node reads data from the second data table, if the transaction identifier corresponding to the data is the same as the transaction identifier of the access operation being performed by the primary node, it will stop reading the data.

[0103] In this embodiment, since there is no overlap between the first and second identifier ranges, the first backup node assigns a transaction identifier from the first identifier range as the first transaction identifier to the first access operation, while the primary node assigns a transaction identifier from the second identifier range as the second transaction identifier to the second access operation, making the first and second transaction identifiers different. Thus, before the second access operation completes, the first backup node will not read the data corresponding to the second transaction identifier from the second data table based on the first transaction identifier. This isolates the first and second access operations through the first and second transaction identifiers, thereby preventing access errors.

[0104] See Figure 4 This application provides a method 400 for assigning identifiers, the method 400 being applied to... Figure 1 or Figure 2 The cloud service architecture 100 shown includes the following steps 401 to 403 in the method 400.

[0105] Step 401: The first backup node establishes the first data table.

[0106] In step 401, when the first backup node establishes a first session connection with the first terminal device, it establishes a first data table corresponding to the first session connection.

[0107] Step 402: The first backup node assigns first identification information to the first data table. The first identification information is different from the identification information of each data table located in at least one data table in the storage layer.

[0108] In step 402, the first backup node takes one of the identifiers in the third identifier range as the first identifier and assigns the first identifier to the first data table.

[0109] The third identifier range and the fourth identifier range containing the identifier information of each data table have no overlap. The identifier information in the third identifier range is identifier information that can be assigned to temporary tables in the backup node. The identifier information included in the fourth identifier range is identifier information that can be assigned to data tables that are persistently stored in the storage layer. Optionally, the identifier information included in the fourth identifier range can also be assigned to temporary tables in the master node.

[0110] In some embodiments, a first target identifier range is preset. The first target identifier range is a range greater than or equal to A and less than or equal to B, where A is less than B, and A and B are both integers. The first target identifier range includes a third identifier range and a fourth identifier range. The third identifier range is greater than or equal to A and less than X1, and the fourth identifier range is the range within the first target identifier range excluding the third identifier range. X1 is the identifier information previously allocated by the master node for a data table, which may be a data table located in the storage layer or a temporary table located in the master node's memory. Alternatively, the third identifier range is a range greater than or equal to X1 and less than or equal to Y1, where X1 is an integer greater than A and less than Y1, Y1 is an integer less than B, and the fourth identifier range includes the range greater than or equal to A and less than X1, and the range greater than Y1 and less than or equal to B.

[0111] In some embodiments, when the third identifier range is greater than or equal to A and less than X1, the process of allocating the first identifier information can be as follows: the first backup node adds the identifier information previously allocated by the first backup node to obtain the first identifier information; if the first identifier information is less than X1, the first identifier information is allocated to the first data table. Optionally, the identifier information initially allocated by the first backup node is the lower limit of the third identifier range.

[0112] In some embodiments, the common area of ​​the storage layer also stores the identification information previously allocated by the master node. When the first standby node is allocated the first identification information for the first data table, it will not update the identification information stored in the common area to the first identification information, thereby avoiding the first standby node from crashing.

[0113] Step 403: The first backup node assigns a first index identifier to the index corresponding to the first data table. The first index identifier is different from the index identifier of each of the at least one index in the storage layer. The at least one index corresponds one-to-one with the at least one data table in the storage layer.

[0114] In step 403, the first backup node uses one of the identifiers in the fifth identifier range as the first index identifier and assigns the first index identifier to the index corresponding to the first data table.

[0115] The index corresponding to the first data table is used to store the identification information and storage location of each piece of data in the first data table. For any given piece of data, the identification information is used to uniquely identify the data, and the storage location of the data is its location within the first data table. Optionally, the storage location of the data might be its row number, etc., within the first data table.

[0116] The first identifier information of the first data table corresponds to the first index identifier of the index corresponding to the first data table.

[0117] The fifth identifier range and the sixth identifier range, which contains the index identifiers of the corresponding indexes for each data table, have no overlap. The identifier information in the fifth identifier range is the index identifier that can be assigned to the index corresponding to the temporary table in the backup node. The identifier information included in the sixth identifier range is the index identifier that can be assigned to the index corresponding to the data table that is persistently stored in the storage layer. Optionally, the identifier information included in the sixth identifier range can also be assigned to the index corresponding to the temporary table in the master node.

[0118] In some embodiments, a second target identifier range is preset. This second target identifier range is a range greater than or equal to C and less than or equal to D, where C is less than D, and both C and D are integers. The second target identifier range includes a fifth identifier range and a sixth identifier range. These fifth and sixth identifier ranges are dynamic. The fifth identifier range is greater than or equal to C and less than X2. The fourth identifier range is the range within the second target identifier range excluding the fifth identifier range. X2 is the index identifier previously assigned by the master node to the index corresponding to the data table. This data table may be a data table located in the storage layer or a temporary table located in the master node's memory. Alternatively, the fifth identifier range is a range greater than or equal to X2 and less than or equal to Y2, where X2 is an integer greater than C and less than Y2, and Y2 is an integer less than D. The sixth identifier range includes a range greater than or equal to C and less than X2, and a range greater than Y2 and less than or equal to D.

[0119] In some embodiments, when the fifth identifier range is greater than or equal to C and less than X2, the process of allocating the first index identifier can be as follows: the first backup node adds the index identifier previously allocated to the first backup node to obtain the first index identifier; if the first index identifier is less than X2, the first index identifier is allocated to the index corresponding to the first data table. Optionally, the index identifier initially allocated by the first backup node is the lower limit of the fifth identifier range.

[0120] In some embodiments, the common area of ​​the storage layer also stores the index identifier previously allocated by the master node. When the first standby node allocates the first index identifier for the index corresponding to the first data table, it will not update the index identifier stored in the common area to the first index identifier, thereby avoiding the first standby node from crashing.

[0121] When the first backup node needs to read a certain data from the first data table, it obtains the first index identifier of the index corresponding to the first data table based on the first identifier information of the first data table. Based on the first index identifier, it determines the index corresponding to the first data table, and based on the identifier information of the data, it obtains the storage location of the data from the index corresponding to the first data table, and then reads the data from the first data table based on that storage location. Alternatively,

[0122] When the first backup node needs to write data to the first data table, it obtains the first index identifier of the index corresponding to the first data table based on the first identifier information of the first data table. Based on the first index identifier, it determines the index corresponding to the first data table, obtains the storage location of the data in the first data table, and stores the data's identifier information and the storage location in the index corresponding to the first data table.

[0123] In this embodiment, since the first backup node allocates first identifier information to the first data table from the third identifier range, and the third identifier range is different from the fourth identifier range in which the master node allocates the identifier information of the data table, it ensures that the first identifier information of the first data table is different from the identifier information allocated by the master node to the data table, thereby avoiding conflicts and errors.

[0124] See Figure 5 This application provides a method 500 for assigning identifiers, which is applied to... Figure 1 or Figure 2 The cloud service architecture 100 shown includes the following steps 501 to 503 in the method 500.

[0125] Step 501: The master node establishes a data table, which may be a second data table located in the storage layer or a third data table located in the master node's memory.

[0126] In step 501, when the master node establishes a second session connection with the second terminal device, it establishes a third data table corresponding to the second session connection.

[0127] Step 502: The master node assigns a second identifier to the data table.

[0128] In step 502, the master node uses one of the identifiers in the fourth identifier range as the second identifier and assigns the second identifier to the data table.

[0129] In some embodiments, when the third identifier range is greater than or equal to A and less than X1, the fourth identifier range is the range within the first upper-level identifier range excluding the third identifier range. The process of allocating the second identifier information can be as follows: the master node reduces the identifier information previously allocated by the master node to obtain the second identifier information; if the second identifier information is greater than the maximum identifier information allocated by the backup node, the second identifier information is allocated to the first data table. Optionally, the identifier information initially allocated by the master node is the upper limit of the fourth identifier range.

[0130] In some embodiments, the public area of ​​the storage layer stores the identification information previously allocated by the master node. After obtaining the second identification information, the master node updates the identification information stored in the public area with the second identification information.

[0131] Step 503: The master node assigns a second index identifier to the index corresponding to the data table.

[0132] In step 503, the first backup node uses one of the identifiers in the sixth identifier range as the second index identifier and assigns the second index identifier to the index corresponding to the data table.

[0133] In some embodiments, when the fifth identifier range is greater than or equal to C and less than X2, the sixth identifier range is the range of the second target identifier range excluding the fifth identifier range. The process of allocating the second index identifier can be as follows: the master node decreases the index identifier previously allocated by the master node to obtain the second index identifier. If the second index identifier is greater than the maximum index identifier allocated by the backup node, the second index identifier is allocated to the index corresponding to the data table. Optionally, the index identifier initially allocated by the master node is the upper limit of the sixth identifier range.

[0134] In some embodiments, the public area of ​​the storage layer stores the index identifier previously allocated by the master node. After obtaining the second index identifier, the master node updates the index identifier stored in the public area to the second index identifier.

[0135] In this embodiment, since the master node allocates second identifier information to the data table from the fourth identifier range, and the fourth identifier range is different from the third identifier range in which the backup node allocates identifier information for the data table, it ensures that the second identifier information of the data table is different from the identifier information allocated by the backup node to the data table, thus avoiding conflicts and errors.

[0136] See Figure 6 This application provides an apparatus 600 for accessing a data table, which can be deployed in... Figure 1 or Figure 2 On the backup node in the cloud service architecture 100 shown, or, it can be deployed on Figure 3 Method 300 or shown Figure 4 On the first backup node of the method 400 shown. The device 600 includes:

[0137] The receiving unit 601 is configured to receive an access request, which indicates a first access operation for a first data table, the first data table being a temporary table in the device 600.

[0138] Processing unit 602 is used to assign a first transaction identifier to the first access operation. The first transaction identifier is different from the second transaction identifier of the second access operation being executed by the master node corresponding to the device 600. The second access operation is used to access the second data table, which is a data table that is persistently stored in the storage layer.

[0139] The processing unit 602 is also configured to access the first data table based on the first transaction identifier through the first access operation.

[0140] Optionally, for details on the implementation process of receiving the access request by the receiving unit 601, please refer to [link / reference needed]. Figure 3 The details of step 301 of method 300 shown will not be explained in detail here.

[0141] Optionally, for details of how processing unit 602 assigns a first transaction identifier to the first access operation, please refer to [link to relevant documentation]. Figure 3 The details of step 302 in method 300 shown will not be explained in detail here.

[0142] Optionally, for details of how processing unit 602 accesses the first data table through the first access operation, please refer to [link to relevant documentation]. Figure 3 The details of step 303 in method 300 shown will not be explained in detail here.

[0143] Optionally, the processing unit 602 is used for:

[0144] Use one of the transaction identifiers in the first identifier range as the first transaction identifier, and assign the first transaction identifier to the first access operation;

[0145] There is no overlap between the first identifier range and the second identifier range containing the second transaction identifier. The transaction identifiers included in the second identifier range are transaction identifiers that can be assigned to the master node for execution.

[0146] Optionally, the processing unit 602 selects a transaction identifier from the first identifier range as the first transaction identifier and assigns the first transaction identifier to the first access operation. For details on this process, please refer to [link to relevant documentation]. Figure 3 The details of step 302 in method 300 shown will not be explained in detail here.

[0147] Optionally, the lower limit of the second identification range is greater than the upper limit of the first identification range.

[0148] Optionally, the access request includes first identification information of the first data table.

[0149] The processing unit 602 is used to access the first data table through a first access operation based on the first identification information and the first transaction identifier.

[0150] Optionally, for details of how processing unit 602 accesses the first data table through a first access operation based on the first identification information and the first transaction identifier, please refer to [link to relevant documentation]. Figure 3 The details of step 303 in method 300 shown will not be explained in detail here.

[0151] Optionally, the processing unit 602 is further configured to:

[0152] Assign first identification information to the first data table. This first identification information is different from the identification information of each data table included in the storage layer.

[0153] Optionally, for details of how processing unit 602 allocates first identification information to the first data table, please refer to [link to relevant documentation]. Figure 4The details of step 402 in method 400 shown will not be explained in detail here.

[0154] Optionally, the processing unit 602 is used for:

[0155] Take one of the identifiers from the third identifier range as the first identifier, and assign the first identifier to the first data table;

[0156] There is no overlap between the third identifier range and the fourth identifier range containing the identifier information of each data table. The identifier information included in the fourth identifier range is the identifier information that can be assigned to the data table that is persistently stored in the storage layer.

[0157] Optionally, the processing unit 602 uses one of the identifiers from the third identifier range as the first identifier and assigns the first identifier to the first data table. For a detailed implementation process, please refer to [link to relevant documentation]. Figure 4 The details of step 402 in method 400 shown will not be explained in detail here.

[0158] Optionally, the processing unit 602 is used for:

[0159] Based on the first identification information, the first index identifier of the index corresponding to the first data table is obtained. This index is used to store the identification information and storage location of each piece of data in the first data table.

[0160] The index is obtained based on the first index identifier;

[0161] Based on the first transaction identifier and the index, the first data table is accessed through the first access operation.

[0162] Optionally, for details of how processing unit 602 obtains the first index identifier of the index corresponding to the first data table based on the first identifier information, please refer to [link to relevant documentation]. Figure 4 The details of step 403 in method 400 shown will not be explained in detail here.

[0163] Optionally, for details on how processing unit 602 obtains the index based on the first index identifier, please refer to [link to relevant documentation]. Figure 4 The details of step 403 in method 400 shown will not be explained in detail here.

[0164] Optionally, for details of the processing unit 602 accessing the first data table through a first access operation based on the first transaction identifier and the index, please refer to [link to relevant documentation]. Figure 4 The details of step 403 in method 400 shown will not be explained in detail here.

[0165] Optionally, the processing unit 602 is further configured to:

[0166] Assign a first index identifier to the index corresponding to the first data table. The first index identifier is different from the index identifier of the index corresponding to each data table included in the storage layer.

[0167] Optionally, for details on how processing unit 602 assigns a first index identifier to the index corresponding to the first data table, please refer to [link to relevant documentation]. Figure 4 The details of step 403 in method 400 shown will not be explained in detail here.

[0168] In this embodiment, the processing unit assigns a first transaction identifier to the first access operation. This first transaction identifier is different from the second transaction identifier of the second access operation being executed by the master node corresponding to the backup node. The master node uses the second access operation based on the second transaction identifier to access the second data table, while the processing unit uses the first access operation based on the first transaction identifier to access the first data table. During the process of accessing the first data table using the first access operation, the processing unit may access the second data table located in the storage layer. Because the first and second transaction identifiers are different, the processing unit will not access the data obtained by the master node during the execution of the second access operation stored in the second data table. This isolates the first and second access operations through the first and second transaction identifiers, preventing access errors.

[0169] See Figure 7 This application provides a computing device 700. For example, the computing device 700 may be... Figure 1 or Figure 2 The nodes (primary or backup nodes) in the cloud service architecture 100 shown, or, are Figure 3 Method 300 or shown Figure 4 The first backup node of method 400 shown, or, is Figure 5 The master node of method 500 is shown.

[0170] like Figure 7 As shown, the computing device 700 includes a bus 702, a processor 704, a memory 706, and a communication interface 708. The processor 704, the memory 706, and the communication interface 708 communicate with each other via the bus 702. The computing device 700 can be a server or a terminal device. It should be understood that this application does not limit the number of processors and memories in the computing device 700.

[0171] The 702 bus can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of representation, Figure 7The bus 702 may be represented by a single line, but this does not mean that there is only one bus or one type of bus. The bus 702 may include a path for transmitting information between various components of the computing device 700 (e.g., memory 706, processor 704, communication interface 708).

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

[0173] The memory 706 may include volatile memory, such as random access memory (RAM). The processor 704 may also include non-volatile memory, such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid state drive (SSD).

[0174] In some embodiments, see Figure 7 The memory 706 stores executable program code, and the processor 704 executes the executable program code to implement the following respectively. Figure 6 The receiving unit 601 and processing unit 602 in the illustrated device 600 function to implement the method provided in any of the above embodiments. That is, the memory 706 stores instructions for executing the method provided in any of the above embodiments. Alternatively,

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

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

[0177] like Figure 8As shown, the computing device cluster includes at least one computing device 700. The memory 706 of one or more computing devices 700 in the computing device cluster may store the same instructions for performing the methods provided in any of the above embodiments.

[0178] In some possible implementations, the memory 706 of one or more computing devices 700 in the computing device cluster may also store partial instructions for performing the data management method described above. In other words, a combination of one or more computing devices 700 can jointly execute instructions for performing the method provided in any of the above embodiments.

[0179] In some possible implementations, one or more computing devices in a computing device cluster can be connected via a network. This network can be a wide area network (WAN) or a local area network (LAN), etc. Figure 9 One possible implementation is shown. For example... Figure 9 As shown, the two computing devices 700A and 700B are connected via a network. Specifically, they are connected to the network through the communication interfaces in each computing device.

[0180] In this type of possible implementation, the memory 706 in the computing device 700A stores the execution of, for example Figure 6 Instructions for the function of the processing unit 602 in the illustrated embodiment. Meanwhile, the memory 706 in the computing device 700B stores instructions for executing such... Figure 6 Instructions for the function of the receiving unit 601 in the illustrated embodiment.

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

[0182] This application also provides another computing device cluster. The connection relationships between the computing devices in this computing device cluster can be similarly referred to... Figure 9 The connection method of the computing device cluster. The difference is that the memory 706 of one or more computing devices 700 in the computing device cluster can store the same instructions for executing the methods provided in any of the above embodiments.

[0183] In some possible implementations, the memory 706 of one or more computing devices 700 in the computing device cluster may also store partial instructions for executing the methods provided in any of the above embodiments. In other words, a combination of one or more computing devices 700 can jointly execute instructions for performing the methods provided in any of the above embodiments.

[0184] This application also provides a computer program product containing instructions. The computer program product may be a software or program product containing instructions, capable of running on a computing device or stored on any usable medium. When the computer program product is run on at least one computing device, it causes the at least one computing device to perform the methods provided in any of the above embodiments.

[0185] This application also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium capable of being stored by a computing device, or a data storage device such as a data center containing one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state drive). The computer-readable storage medium includes instructions that instruct a computing device to perform the method provided in any of the above embodiments.

[0186] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.

[0187] The above description is merely an optional embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the principles of this application should be included within the protection scope of this application.

Claims

1. A method for accessing a data table, characterized in that, The method includes: The backup node receives an access request, which indicates a first access operation for a first data table, which is a temporary table in the backup node. If the most recently allocated transaction identifier of the backup node is not the upper limit of the first identifier range, the backup node adds the most recently allocated transaction identifier to obtain the first transaction identifier of the first access operation. If the most recently allocated transaction identifier of the backup node is the upper limit of the first identifier range, the backup node uses the lower limit of the first identifier range as the first transaction identifier of the first access operation. The first transaction identifier is different from the second transaction identifier of the second access operation being executed by the master node corresponding to the backup node. The second access operation is used to access the second data table, which is a data table that is persistently stored in the storage layer. There is no intersection between the first identifier range and the second identifier range in which the second transaction identifier is located. The transaction identifiers included in the second identifier range are transaction identifiers that can be allocated to the access operation executed by the master node. The backup node accesses the first data table through the first access operation based on the first transaction identifier.

2. The method as described in claim 1, characterized in that, The lower limit of the second identification range is greater than the upper limit of the first identification range.

3. The method as described in claim 1 or 2, characterized in that, The access request includes the first identifier information of the first data table. The backup node accesses the first data table based on the first transaction identifier through the first access operation, including: The backup node accesses the first data table through the first access operation based on the first identification information and the first transaction identifier.

4. The method as described in claim 3, characterized in that, The method further includes: The backup node assigns first identification information to the first data table, and the first identification information is different from the identification information of each data table included in the storage layer.

5. The method as described in claim 4, characterized in that, The backup node assigns first identification information to the first data table, including: The backup node uses one of the identifiers in the third identifier range as the first identifier and assigns the first identifier to the first data table. There is no overlap between the third identification range and the fourth identification range containing the identification information of each data table. The identification information included in the fourth identification range is the identification information that can be assigned to the data table that is persistently stored in the storage layer.

6. The method as described in claim 4 or 5, characterized in that, The backup node accesses the first data table through the first access operation based on the first identification information and the first transaction identifier, including: The backup node obtains the first index identifier of the index corresponding to the first data table based on the first identifier information. The index is used to store the identifier information and storage location of each piece of data in the first data table. The backup node obtains the index based on the first index identifier; The backup node accesses the first data table through the first access operation based on the first transaction identifier and the index.

7. The method as described in claim 6, characterized in that, The method further includes: The backup node assigns a first index identifier to the index corresponding to the first data table. The first index identifier is different from the index identifier of the index corresponding to each data table included in the storage layer.

8. An apparatus for accessing a data table, characterized in that, The device includes: A receiving unit is configured to receive an access request, the access request being used to indicate a first access operation for a first data table, the first data table being a temporary table in the device; The processing unit is configured to, when the transaction identifier most recently allocated to the device is not the upper limit of the first identifier range, add the most recently allocated transaction identifier to obtain the first transaction identifier of the first access operation; when the transaction identifier most recently allocated to the device is the upper limit of the first identifier range, use the lower limit of the first identifier range as the first transaction identifier of the first access operation. The first transaction identifier is different from the second transaction identifier of the second access operation being executed by the master node corresponding to the device. The second access operation is used to access the second data table, which is a data table persistently stored in the storage layer. There is no intersection between the first identifier range and the second identifier range in which the second transaction identifier is located. The transaction identifiers included in the second identifier range are transaction identifiers that can be allocated to the access operation executed by the master node. The processing unit is further configured to access the first data table based on the first transaction identifier through the first access operation.

9. The apparatus as claimed in claim 8, characterized in that, The lower limit of the second identification range is greater than the upper limit of the first identification range.

10. The apparatus as claimed in claim 8 or 9, characterized in that, The access request includes the first identifier information of the first data table. The processing unit is configured to access the first data table through the first access operation based on the first identification information and the first transaction identifier.

11. The apparatus as claimed in claim 10, characterized in that, The processing unit is further configured to: Assign first identification information to the first data table. The first identification information is different from the identification information of each data table included in the storage layer.

12. The apparatus as claimed in claim 11, characterized in that, The processing unit is used for: Take one of the identifiers from the third identifier range as the first identifier, and assign the first identifier to the first data table; There is no overlap between the third identification range and the fourth identification range containing the identification information of each data table. The identification information included in the fourth identification range is the identification information that can be assigned to the data table that is persistently stored in the storage layer.

13. The apparatus as claimed in claim 11 or 12, characterized in that, The processing unit is used for: Based on the first identification information, the first index identifier of the index corresponding to the first data table is obtained, and the index is used to store the identification information and storage location of each piece of data in the first data table; The index is obtained based on the first index identifier; Based on the first transaction identifier and the index, the first data table is accessed through the first access operation.

14. The apparatus as claimed in claim 13, characterized in that, The processing unit is further configured to: Assign a first index identifier to the index corresponding to the first data table. The first index identifier is different from the index identifier of the index corresponding to each data table included in the storage layer.

15. An apparatus for accessing a data table, characterized in that, It includes at least one processor, the at least one processor being coupled to a memory, reading and executing instructions in the memory to implement the method as claimed in any one of claims 1-7.

16. A computer storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1-7.

17. A computer program product comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1-7.