Data access method and device

By judging the data status after data acquisition, the client node avoids mutually exclusive operations, solves the problems of increased CPU resource overhead and decreased data transmission performance, and achieves efficient data transmission.

CN120692259APending Publication Date: 2025-09-23CHENGDU HUAWEI TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202410325453.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-03-21
Publication Date
2025-09-23

AI Technical Summary

Technical Problem

The client node performs mutual exclusion operations before obtaining data, which increases CPU resource overhead and degrades data transmission performance.

Method used

After the client node obtains the data from the server node, it uses the verification information in the data to determine the data status, avoids performing mutually exclusive operations before obtaining the data, and ensures the consistency and validity of the data.

Benefits of technology

It reduces the CPU resource overhead of the client node and improves the data transmission performance between the client node and the server node.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120692259A_ABST
    Figure CN120692259A_ABST
Patent Text Reader

Abstract

The invention discloses a data access method and device, and the method comprises the steps: a client node obtains first data from a server node, and determines that target data is valid if determining that the target data in the first data is not in a first state according to verification information in the first data; and if the target data in the first data is determined to be in the first state according to the verification information in the first data, abandoning the first data. Wherein the verification information in the first data is used for determining whether target data in the first data is in a first state, and the first state indicates that the target data is in a transaction processing process. On this basis, the client node ensures the consistency and validity of the target data through the verification information, and the validity and consistency of the target data are not ensured through mutual exclusion operation any more, so that the CPU resource overhead of the server node and the client node is reduced, and the data transmission performance between the client node and the server node is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a data access method and device. Background Art

[0002] Client nodes and server nodes are the fundamental components of a network. Client nodes are responsible for interacting with users, displaying data and interfaces, and communicating with servers over the network to retrieve or submit data. Server nodes are responsible for processing and responding to requests from client nodes, storing and managing data, performing computations, and providing services to client nodes.

[0003] Before obtaining data from the server node, the client node usually performs mutual exclusion operations, such as adding read-write locks to the data, to ensure the consistency and validity of the data.

[0004] Mutual exclusion operations require the participation of the Central Processing Unit (CPU), which increases the CPU resource overhead of the client node and the server node. In addition, performing mutual exclusion operations before obtaining data causes a long delay in the client node obtaining data, affecting the data transmission performance between the client node and the server node. Summary of the Invention

[0005] The embodiments of the present application provide a data access method and apparatus for reducing resource overhead of data access and improving data transmission performance between a client node and a server node.

[0006] In the first aspect, the present application provides a data acquisition method, which can be applied to a first device, or a module (such as a chip) of the first device, or a system corresponding to the first device, and the first device can be a terminal device serving as a client node. The method is described below with the client node as the execution subject. The method may include the following steps: the client node obtains the first data from the server node, and if it is determined that the target data in the first data is not in the first state based on the verification information in the first data, the target data is determined to be valid; if it is determined that the target data in the first data is in the first state based on the verification information in the first data, the first data is abandoned. The verification information in the first data is used to determine whether the target data in the first data is in the first state, and the first state indicates that the target data is in the transaction processing process.

[0007] In this method, the client node does not perform a mutually exclusive operation before obtaining the first data from the server node. By directly obtaining the first data from the server node, the efficiency of the client node in obtaining data is improved, and the data transmission performance between the client node and the server node is improved. In addition, after the client node obtains the first data, when it is determined that the first data is not currently in the transaction processing process (or the target data is being processed and the processing operation has not yet been completed), it is determined that the target data in the first data is valid, or it can be understood that the target data at this time is allowed to be used when executing the business, thereby ensuring the consistency and validity of the target data. In other words, the technical solution of the present application is that the client node judges the validity and consistency of the data after obtaining the data, and then uses the target data with consistency and validity, rather than ensuring the validity and consistency of the data through a mutually exclusive operation before obtaining the data, thereby improving the data transmission performance between the client node and the server node. In addition, because no mutually exclusive operation is performed, the CPU of the client node is avoided from participating in the mutually exclusive operation, reducing the CPU resource overhead of the client node.

[0008] In one possible implementation, the verification information includes first information and second information; based on this, when the client node determines that the first information and the second information are the same, it determines that the target data is not in the first state; when the client node determines that the first information and the second information are not the same, it determines that the target data is in the first state.

[0009] In this implementation, when the first data is being processed (also referred to as a write operation), the server node sets the first information and the second information in the first data to be different, thereby indicating that the first data is in the first state; when the first data is not being processed (which can be understood as completing the write operation), the server node sets the first information and the second information in the first data to be the same, thereby indicating that the first data is not in the first state; based on this, the client node that obtains the first data can indirectly determine whether the first data is in the first state, or in other words, the client node can determine whether the first data is valid, thereby ensuring the validity and consistency of the target data.

[0010] In one possible implementation, the first data includes a first field, a second field and a data field, the first field carries the first information, the second field carries the second information, the data field carries the target data, the first field is located before the data field, and the second field is located after the data field.

[0011] In this implementation, after obtaining the first data, the client node can first determine whether the first data is in the first state using the first field and the second field in the first data. If the first data is determined to be in the first state, the client node reads the data field in the first data to obtain the target data. If the client node determines that the first data is not in the first state, the client node no longer reads the data field in the first data to obtain the target data and directly discards the first data, thereby saving computer resources consumed by reading the information in the data field. The target data can be understood as data required by the client node when processing business.

[0012] In one possible implementation, the verification information includes first information, second information and third information, and the third information is used to indicate whether the target data is locked; based on this, if the client node determines that the third information indicates that the target data is not locked, and the first information and the second information are the same, it is determined that the target data is not in the first state; if the client node determines that the third information indicates that the target data is locked, and / or the first information and the second information are different, it is determined that the target data is in the first state.

[0013] In this implementation, the third information indicating that the target data is locked can be understood as indicating that the target data is being processed or needs to be processed. In this case, the target data cannot be considered valid data. Therefore, even if the first information and the second information in the first data are identical, if the third information indicates that the target data is locked, the first data is still determined to be in the first state, thereby ensuring the validity and consistency of the target data.

[0014] Exemplarily, after the client node obtains the first data, it can first determine whether the target data is locked through the third information in the first field. If it is determined that the third information indicates that the target data is locked, it is directly determined that the target data is in the first state, and there is no need to read the information in the second field and the data field, thereby saving computer resources consumed by reading the information in the field.

[0015] In one possible implementation, the first data includes a first field, a second field and a data field, the first field carries the first information and the third information, the second field carries the second information, the data field carries the target data, the first field is located before the data field, and the second field is located after the data field.

[0016] In a possible implementation, the first information is a first serial number, and the second information is a second serial number.

[0017] In this implementation, the serial number is used as verification information to facilitate the client node to compare the first information and the second information.

[0018] In a possible implementation, an RDMA connection is established between the client node and the server node; based on this, the client node obtains the first data from the server node through the RDMA connection.

[0019] In this implementation, the client node obtains the first data from the server node based on remote direct memory access (RDMA) technology, thereby reducing the CPU overhead of data transmission and meeting the business requirements for high throughput and low latency characteristics.

[0020] In the second aspect, the present application provides a data storage method, which can be applied to a second device, or a module (such as a chip) of a second device, or a system corresponding to the second device, and the second device can be a network device (such as a server) serving as a server node. The method is described below with the server node as the execution subject. The method may include the following steps: the server node receives a first request, and in response to the first request, sets the verification information of the target data to a first state value at the start time of processing the target data, processes the target data, and sets the verification information to a second state value at the completion time of processing the target data. The first request is used to indicate that the target data is to be processed, the first state value indicates that the target data is in a first state, and the first state indicates that the target data is in the process of transaction processing.

[0021] In this method, the server node sets different status values ​​for verification information at the start and completion times of target data processing. Verification information with different status values ​​indicates whether the target data is currently in a first state, thereby indirectly enabling the client node that obtains the first data to determine whether the first data is in the first state, or in other words, enabling the client node to determine whether the first data is valid, thereby ensuring the validity and consistency of the target data. Furthermore, regardless of whether the target data is being processed, no mutually exclusive operations are performed on the target data. This prevents the server node's CPU from participating in mutually exclusive operations, reduces the server node's CPU resource overhead, and improves data transmission performance between the client and server nodes.

[0022] In one possible implementation, the verification information includes first information and second information. Based on this, at the start of processing the target data, the server node increments the value of the first information while maintaining the value of the second information unchanged. At this point, the verification information is set to a first state value. At the completion of processing the target data, the server node increments the value of the second information while maintaining the value of the first information unchanged. At this point, the verification information is set to a second state value. The incremented second information is identical to the incremented first information.

[0023] In one possible implementation, the processed target data is stored as first data, the first data includes a first field, a second field and a data field, the first field carries the first information, the second field carries the second information, the data field carries the target data, the first field is located before the data field, and the second field is located after the data field.

[0024] In this implementation, the first field and the second field in the first data indicate whether the first data is in the first state. After obtaining the first data, the client determines that the first data is in the first state through the information in the first field and the second field, and then reads the data field in the first data to obtain the target data; when it is determined that the first data is not in the first state through the information in the first field and the second field, the data field in the first data is not read to obtain the target data, and the first data is directly discarded, thereby saving computer resources consumed by reading the information in the data field.

[0025] In one possible implementation, the verification information includes first information, second information, and third information, and the third information is used to indicate whether the target data is locked; based on this, the server node sets the third information to the first value at the start of processing the target data, and increments the value of the first information, while keeping the value of the second information unchanged. At this time, the verification information of the target data is set to the first state value, wherein the first value indicates that the target data is locked. At the completion of processing the target data, the server node increments the value of the second information, while keeping the value of the first information unchanged, and sets the third information to the second value. At this time, the verification information of the target data is set to the second state value, wherein the second value indicates that the target data is not locked, and the incremented second information is the same as the incremented first information.

[0026] In one possible implementation, the processed target data is stored as first data, the first data includes a first field, a second field and a data field, the first field carries the first information and the third information, the second field carries the second information, the data field carries the target data, the first field is located before the data field, and the second field is located after the data field.

[0027] In a possible implementation, the first information is a first serial number, and the second information is a second serial number.

[0028] In this implementation, the serial number is used as verification information to facilitate the server node to set the first information and the second information.

[0029] In a third aspect, a device is provided, comprising a unit or module for executing the method as described in any one of the first aspect or the second aspect above.

[0030] In a fourth aspect, a device is provided, comprising: one or more processors configured to execute the method described in any one of the first or second aspects above.

[0031] In one possible implementation, the device further includes one or more memories; wherein the one or more memories store one or more programs, and when the programs are executed by the one or more processors, the device executes any one of the methods described in the first or second aspect above.

[0032] In a fifth aspect, a chip system is provided, which includes at least one chip and a memory, and the at least one chip is used to read and execute the program stored in the memory to implement the method described in any one of the first or second aspects above.

[0033] In a sixth aspect, a readable storage medium is provided, wherein the readable storage medium includes a program, and when the program is run on a device, the device executes the method described in any one of the first aspect or the second aspect.

[0034] In a seventh aspect, a program product is provided. When the program product is run on a device, the device is caused to execute the method described in any one of the first or second aspects.

[0035] Based on the implementations provided in the above aspects, the embodiments of the present application can be further combined to provide more implementations.

[0036] The technical effects that can be achieved in any of the third to seventh aspects mentioned above can be referred to the description of the technical effects that can be achieved in the first and / or second aspects mentioned above, and the repetitions will not be discussed here. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] Figure 1 A schematic diagram of a system architecture applicable to embodiments of the present application;

[0038] Figure 2A A schematic diagram of first data provided in an embodiment of the present application;

[0039] Figure 2B A schematic diagram of another first data provided in an embodiment of the present application;

[0040] Figure 2C A schematic diagram of another first data provided in an embodiment of the present application;

[0041] Figure 3 A flowchart of a data storage method provided in an embodiment of the present application;

[0042] Figure 4 A schematic diagram of generating first data provided in an embodiment of the present application;

[0043] Figure 5 Another schematic diagram of generating first data provided in an embodiment of the present application;

[0044] Figure 6 A flow chart of a data acquisition method provided in an embodiment of the present application;

[0045] Figure 7 A structural diagram of a data access device provided in an embodiment of the present application;

[0046] Figure 8 A schematic structural diagram of another data access device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0047] Client nodes and server nodes are the fundamental components of a network. Client nodes are typically responsible for interacting with users, displaying data and interfaces, and communicating with servers over the network to retrieve or submit data. Server nodes are typically responsible for processing and responding to requests from client nodes, storing and managing data, performing computations, and providing services to client nodes.

[0048] Data transmission between client nodes and server nodes is typically achieved through Remote Procedure Call (RPC) technology. With the advancement of computer technology, the number of client nodes in a network has increased, leading to an increase in the data storage capacity of server nodes. To reduce the CPU overhead of data transmission in the network and meet business requirements for high throughput and low latency, remote direct memory access (RDMA) transmission can be introduced into the network. This means establishing an RDMA link between client nodes and server nodes for data transmission.

[0049] Currently, before a client node obtains data from a server node, it must perform a mutually exclusive operation (such as a locking operation) on the data to ensure data consistency and validity. This includes setting a mutual exclusion lock or a read-write lock on the data. For example, a client node sends a request to the server node, which includes the identifier of the data to be obtained. After receiving the request, the server node locks the data (such as a read lock) based on the identifier of the data. At this point, the data is locked, and the server node will not respond to other client nodes' access requests to the data at this time. This ensures that the data obtained by the client node is unprocessed, thereby ensuring data consistency and validity.

[0050] Each time a client retrieves data, it must first perform a mutual exclusion operation on the data in the server node before retrieving the data. This results in low data retrieval efficiency for the client node and affects the data transmission performance between the client and server nodes. Furthermore, each mutual exclusion operation requires the CPU of both the client and server nodes, increasing CPU resource overhead.

[0051] To this end, an embodiment of the present application provides a data access method for reducing the CPU resource overhead of a server node and a client node, and improving the data transmission performance between the client node and the server node.

[0052] The embodiments of the present application are described in detail below with reference to the accompanying drawings.

[0053] First, the system architecture of the embodiment of the present application is introduced. Figure 1As shown, a system architecture diagram applicable to a data access method provided in an embodiment of the present application is shown. The system may include a client node 100 and a server node 200. The client node 100 may be a terminal device, and the server node 200 may be a network device. It is understood that the terminal device may be a device equipped with a display screen and capable of human-computer interaction through the display screen. For example, the terminal device may be a mobile phone, a tablet computer, a laptop computer, a netbook, a car-mounted device, a business intelligence terminal (including: videophone, conference desktop intelligent terminal, etc.), a personal digital assistant (PDA), an augmented reality (AR) or virtual reality (VR) device, etc. The network device may be one or more cloud servers, or one or more server clusters (which may be simply referred to as servers) in any data center. The embodiment of the present application does not limit the specific form of the client node 100 and the server node 200. It should be understood that a communication connection can be established between the client node 100 and the server node 200 through a communication network, which may be a local area network or a wide area network transferred through a relay device. When the communication network is a local area network, illustratively, the communication network may be a wireless fidelity (Wi-Fi) network, a Bluetooth (BT) network, etc. When the communication network is a wide area network, illustratively, the communication network may be a third-generation wireless telephone technology (3G) network, a fourth-generation mobile communication technology (4G) network, a fifth-generation mobile communication technology (5G) network, a future-evolved public land mobile network (PLMN), or the Internet, etc.

[0054] The execution entities of data access provided in the embodiments of the present application are introduced using client nodes and server nodes as examples. The network client node in the embodiments of the present application can be a terminal device, or a chip, unit or module in a terminal device, or a device with terminal functions or a chip, unit or module inside a device with terminal functions. The server node in the embodiments of the present application can be a network device, or a chip, unit or module in a network device, or a device with network device functions or a chip, unit or module inside a device with network device functions.

[0055] Based on the above Figure 1 The system architecture shown in the embodiment of the present application is to set verification information for the data, and to indicate the status of the data (such as whether the current data is being processed, or whether it is in the process of transaction processing) through the verification information, so that the client node can determine whether the acquired data can be used. The client node 100 obtains the required first data from the server node 200, and the first data includes target data and verification information. After the client node 100 obtains the first data, if it determines that the target information has not been processed, or is not in the process of transaction processing according to the verification information in the first data, it determines that the target data is allowed to be used, and then uses the target data to process the business. Among them, the server node 200 can set the verification information of the data when processing the data (such as storing or modifying the data), and then generate the first data based on the data and the verification information.

[0056] In one possible implementation, refer to Figure 2A The first data includes a first field, a second field, and a data field. The first field carries the first information in the verification information, the second field carries the second information in the verification information, and the data field carries data. The data carried in the data field can be service data or user data, such as image data, video data, text data, or voice data.

[0057] In one possible implementation, the first information and the second information are used to indicate the current state of the data, which includes the first state and the second state:

[0058] First state: If the first information and the second information are different, the data in the data field is currently in the first state. The first state indicates that the data is in the process of transaction processing, or that the data is being processed by the server node. At this time, it means that the data does not meet the transaction processing requirements, the data does not meet the atomicity requirements, or the data does not meet the consistency requirements.

[0059] Typically, data processing (or database processing) is performed based on a transaction mechanism. When processing data, multiple operations are executed as a logical unit during the data processing process to ensure the correctness of the data. A transaction refers to a set of data operations (or database operations) that are either all executed successfully or all failed and rolled back. Transaction processing should meet requirements such as atomicity and consistency. Atomicity means that all operations in a transaction are either all executed successfully or all rolled back. Consistency means that after the transaction ends, the state of the data should meet the expected consistency requirements. Taking the modification of the first data as an example, the server node first reads the first data from the disk, stores it in a cache unit, then modifies the data in the cache unit, and finally writes the modified data to the disk. Therefore, the read and write operations are used as the smallest logical unit of the transaction processing. Only after all processing operations of the smallest logical unit are completed can the atomicity and consistency of the first data be guaranteed.

[0060] Since the data in the first state does not meet the atomicity or consistency requirements, in order to ensure the correctness of the data, the data in the first state can be considered as invalid data, or the data cannot be used for business processing.

[0061] Second state: If the first information and the second information are the same, it means that the data is currently in the second state, or the data meets the atomicity requirement, or the data meets the consistency requirement.

[0062] The first information and the second information are set by the server node when performing a transaction on the data. Specifically, at the start and end times of the transaction, the server node sets the first information and the second information corresponding to the data. For example, using the example of performing a transaction on the first data, the first information is set by the server node at the start time of the transaction, and the second information is set by the server node at the end time of the transaction.

[0063] The data types of the first information and the second information can be strings or integers, etc., which are not limited. Optionally, the first information is a first serial number, and the second information is a second serial number.

[0064] The data capacity of the first information and the second information can be preset based on experience and is not limited thereto. Optionally, the data capacity of the first information and the second information can be 8 bytes (B).

[0065] In the embodiment of the present application, the positions of the first field, the second field and the data field are not limited. For example, Figure 2AAs shown, the first field is located before the data field, and the second field is located after the data field. The first field can be called a header field, the second field can be called a tail field, the first information can be called header information, and the second information can be called tail information. It can be understood that the first field and the second field can both be located before the data field, or the first field and the second field can both be located after the data field.

[0066] In one possible implementation, refer to Figure 2B The first data includes a first field, a second field, and a data field. The first field carries the first and third information in the verification information, and the second field carries the second information in the verification information. The first, second, and third information are used to indicate the current state of the data. Referring to the above description, the state includes the first and second states. The data field carries the first and second information, as described above, and is not further described here. It should be understood that the third information may also be carried in the second field.

[0067] In one possible implementation, the third information is used to indicate whether the data is locked. Optionally, the third information may be a flag bit information, such as when the flag bit of the third information is "1", it indicates that the data is locked, and when the flag bit of the third information is "0", it indicates that the data is not locked, and vice versa.

[0068] In one possible implementation, the third information is set by the server node when executing a transaction on the data. Specifically, the server node sets the third information corresponding to the data at the start and end times of the transaction. For example, when executing a transaction on first data, the server node sets the third information at the start of the transaction to indicate that the data is locked, and at the end of the transaction to indicate that the data is unlocked.

[0069] In one possible implementation, the states indicated by the first information, the second information, and the third information specifically include the following situations:

[0070] Case 1: The third information indicates that the data is locked and the first information and the second information are different. Case 1 at this time can be understood as the data is in the process of executing a transaction, that is, the data is currently in the first state.

[0071] Case 2: The third information indicates that the data is locked and the first information and the second information are the same. Case 2 at this time can be understood as the transaction process of the data has not yet ended, that is, the data is currently in the first state.

[0072] Case 3: The third information indicates that the data is not locked and the first information and the second information are different. Case 3 at this time can be understood as the data is not in the transaction execution process, but because the first information and the second information are different, it indicates that the data does not meet the atomicity or consistency requirements, that is, the data is currently in the first state.

[0073] This situation may be caused by an exception occurring when setting the first information or the second information during the transaction processing, resulting in a setting error or failure.

[0074] Case 4: The third information indicates that the data is not locked and the first information and the second information are the same. Case 4 at this time can be understood as the data is not currently in the transaction processing process, and the data meets the atomicity and consistency requirements, that is, the data is currently in the second state.

[0075] In one possible implementation, refer to Figure 2C The first data includes a first field, a second field, a third field, and a data field. The first field carries the first information in the verification information, the second field carries the second information in the verification information, the third field carries the third information in the verification information, and the data field carries data. The first information, the second information, and the third information are described above and are not described in detail here.

[0076] Optionally, the third field is located before the first field, or the third field is located after the second field. The position of the third field is not limited here.

[0077] The present application will be described in further detail below with reference to the accompanying drawings. The specific operating methods in the method embodiments can also be applied to the device embodiments or system embodiments.

[0078] Based on the above Figure 1 The system architecture shown and the above-mentioned related technical introductions, Figure 3 The following is a flow chart illustrating a data storage method provided in an embodiment of the present application. Figure 3 The solution in the embodiment is introduced by taking the interactive execution of the server node and the client node as an example. The relevant description of the server node and the client node can be found in the above content and will not be repeated here.

[0079] like Figure 3 As shown, the method may include the following steps:

[0080] Step 310: The client node sends a first request to the server node, where the first request instructs processing of target data.

[0081] In this process, the processing operation of the target data indicated by the first request may include an operation of adding the target data, an operation of modifying the target data, or an operation of deleting the target data.

[0082] Step 320: In response to the first request, the server node sets the verification information of the target data to a first state value at the start of processing the target data, where the first state value indicates that the target data is in a first state.

[0083] Based on the above description, the first data includes target data and verification information. The target data is carried in the data field, and the verification information is carried in the first field and the second field. For example, when the verification information includes the first information and the second information, at the start of processing the target data, the server node increments the value of the first information and maintains the value of the second information unchanged. At this point, the verification information of the target data is set to the first state value.

[0084] Exemplarily, before executing transaction processing on the first data, the first data includes the following: Figure 4 The information shown in Figure a:

[0085] First message: 01;

[0086] Target data: xx;

[0087] Second message: 01;

[0088] At time t0, the transaction processing is started on the first data, the first information is incremented by 1, and the value of the second information remains unchanged. At this time, the first data includes the following: Figure 4 Information shown in Figure b:

[0089] First message: 02;

[0090] Target data: xx (before processing);

[0091] Second message: 01;

[0092] It can be understood that the first information and the second information in the verification information are set to be different, which means that the verification information is set to the first state value.

[0093] For example, if the verification information includes first, second, and third information, at the start of processing the target data, the server node first sets the third information to a first value, then increments the value of the first information while keeping the value of the second information unchanged. At this point, the verification information of the target data is set to a first state value. The first value indicates that the target data is locked, and the first value is "1."

[0094] Exemplarily, before executing transaction processing on the first data, the first data includes the following: Figure 5 The information shown in Figure a:

[0095] The third message: "0";

[0096] First message: 01;

[0097] Target data: xx;

[0098] Second message: 01;

[0099] At time t2, the transaction processing is started on the first data. First, the third information is set from "0" to "1". At this time, the first data includes the following: Figure 5 Information shown in Figure b:

[0100] The third message: "1";

[0101] First message: 01;

[0102] Target data: xx;

[0103] Second message: 01;

[0104] During the transaction processing, after the third information is set from "0" to "1", the first information is incremented by 1 at time t3, and the value of the second information remains unchanged. At this time, the first data includes the following: Figure 5 Information shown in Figure c:

[0105] The third message: "1";

[0106] First message: 02;

[0107] Target data: xx;

[0108] Second message: 01;

[0109] It can be understood that the first information and the second information in the verification information are set to be different and the third information indicates that the target data in the first data is locked, which means that the verification information is set to the first state value.

[0110] Step 330: The server node processes the target data and sets the verification information to a second state value when the processing of the target data is completed.

[0111] Taking the example of verification information including first information and second information, when the server node completes processing the target data, it increments the value of the second information and keeps the value of the first information unchanged, wherein the incremented second information is the same as the first information (which can be understood as the incremented first information in the above step 320), and the verification information of the target data is now set to the second state value.

[0112] For example, during the transaction processing, the target data in the first data is processed until the transaction processing of the first data is completed at time t1, the second information is incremented by 1, and the value of the first information remains unchanged. At this time, the first data includes the following: Figure 4 Information shown in Figure c:

[0113] First message: 02;

[0114] Target data: xx`(after processing);

[0115] Second message: 02;

[0116] It can be understood that the first information and the second information in the verification information are set to be the same, indicating that the verification information of the target data is set to the second state value.

[0117] For example, if the verification information includes first, second, and third information, upon completion of processing the target data, the server node first increments the value of the second information, maintains the value of the first information unchanged, and then sets the third information to the second value. At this point, the verification information of the target data is set to the second state value. The second value indicates that the target data is unlocked, and the second value is "0."

[0118] For example, during the transaction processing, the target data in the first data is processed until the target data in the first data is processed at time t4, the second information is incremented by 1, and the value of the first information remains unchanged. At this time, the first data includes the following: Figure 5 Information shown in Figure d:

[0119] The third message: "1";

[0120] First message: 02;

[0121] Target data: xx`;

[0122] Second message: 02;

[0123] At time t5, the transaction processing of the first data is completed, and the third information is set from "1" to "0". At this time, the first data includes the following: Figure 5 Information shown in Figure e:

[0124] The third message: "0";

[0125] First message: 02;

[0126] Target data: xx`;

[0127] Second message: 02;

[0128] It can be understood that the first information and the second information in the verification information are set to be the same and the third information indicates that the target data in the first data is not locked, which means that the verification information is set to the second state value.

[0129] In the above technical solution, the check information set to the first state value is used to indicate that the target data is in the first state, and the check information set to the second state value is used to indicate that the target data is in the second state. In other words, the check information in the first data is used to enable the client node that obtains the first data to determine whether the target data is in the first state, and then the client node can determine whether the target data is valid, or whether the target data can be used. The method executed by the client node refers to the following Figure 6 The description is not described in detail here.

[0130] In summary, the server node sets different status values ​​for the verification information of the target data at the start and end times of the write operation service for the target data, respectively. The verification information with different status values ​​indicates whether the target data is currently in the first state, thereby indirectly allowing the client node that obtains the first data to determine whether the first data is in the first state, or in other words, allowing the client node to determine whether the first data is valid, thereby ensuring the validity and consistency of the target data. In addition, regardless of whether the target data is processed, the server node does not perform mutually exclusive operations on the target data, thereby avoiding the server node's CPU from participating in mutually exclusive operations, reducing the server node's CPU resource overhead, and improving the data transmission performance between the client node and the server node.

[0131] Based on the above Figure 1 The system architecture shown and the above-mentioned related technical introductions, Figure 6 The following is a flow chart illustrating a data storage method provided in an embodiment of the present application. Figure 6 The solution in the embodiment is introduced by taking the interactive execution of the server node and the client node as an example. The relevant description of the server node and the client node can be found in the above content and will not be repeated here.

[0132] like Figure 6 As shown, the method may include the following steps:

[0133] Before executing step 610, the client node sends a second request to the server node, where the second request includes an identifier of the target data, and the second request is used to instruct to obtain the target data.

[0134] Step 610: The server node sends first data to the client node. The first data includes target data and verification information. The verification information is used to determine whether the target data is in a first state. The first state indicates that the target data is in a transaction processing process.

[0135] In this process, after receiving the second request, the server node sends the first data corresponding to the target data to the client node. The first data is generated and stored according to the target data. The specific generation method is described in the above. Figure 3 The technical solution is not described in detail here.

[0136] Optionally, a remote direct memory access (RDMA) connection is established between the client node and the server node; based on this, the client node can obtain the first data from the server node through the RDMA connection, thereby reducing the CPU overhead of data transmission between the client node and the server node, and meeting the business requirements for high throughput and low latency characteristics.

[0137] Optionally, data transmission between the client node and the server node is a one-sided RDMA operation. A one-sided RDMA operation can be understood as one end of an RDMA connection performing a read or write operation over the RDMA connection, while the other end performs no operation. Optionally, the client node performs a read or write operation over the RDMA connection, while the server node performs no operation.

[0138] Exemplarily, the unilateral RDMA operation applicable to the embodiment of the present application includes the following contents: the client node establishes an RDMA connection with the server node, creates and initializes Queue Pairs (QP), and the QP includes a send queue (SQ) in the server node and a receive queue (RQ) in the client node. Among them, the first data is archived in the SQ in the buffer of the server node, and the buffer address of the server node is registered in the network card (NIC) of the server node. The client node moves the first data in the SQ of the server node to its own RQ through its own NIC and the NIC of the server node. Because the server node does not perform any operation, the server node does not involve CPU overhead, improves the performance of the server node in transmitting data to the client node, and reduces the latency of the client node in obtaining data, thereby meeting the business requirements for high throughput and low latency characteristics.

[0139] Optionally, the client node may obtain the first data from a distributed cache system that caches some or all of the data in the server node. In other words, the client node may indirectly obtain the first data in the server node through the distributed cache system.

[0140] Step 620: The client node determines whether the target data is in the first state based on the verification information. If so, step 640 is executed; otherwise, step 630 is executed.

[0141] Taking the example of verification information including first information and second information, if the client node determines that the first information and the second information are the same, it is determined that the target data is not in the first state. Exemplarily, the first data obtained by the client node includes the following: Figure 4 Information shown in Figure c:

[0142] First message: 02;

[0143] Target data: xx`;

[0144] Second message: 02;

[0145] It can be seen that the first information and the second information in the first data are the same, indicating that the verification information of the first data is set to the second state value, or that the target data in the first data is not in the first state, thereby determining that the target data is valid.

[0146] In a possible implementation, if the client node determines that the first information and the second information are different, it determines that the target data is in the first state. Exemplarily, the first data obtained by the client node includes the following: Figure 4 Information shown in Figure b:

[0147] First message: 02;

[0148] Target data: xx;

[0149] Second message: 01;

[0150] It can be seen that the first information and the second information in the first data are different, indicating that the verification information of the first data is set to the first state value, or that the target data in the first data is in the first state, thereby determining that the target data is invalid.

[0151] Taking the example that the verification information includes the first information, the second information and the third information, if the client node determines that the third information indicates that the target data is not locked, and the first information and the second information are the same, then it is determined that the target data is not in the first state. Exemplarily, the first data obtained by the client node includes the following: Figure 5 Information shown in Figure e:

[0152] The third message: "0";

[0153] First message: 02;

[0154] Target data: xx`;

[0155] Second message: 02;

[0156] It can be seen that the third information in the first data indicates that the target data in the first data is not locked, and the first information and the second information in the first data are the same, indicating that the verification information of the first data is set to the second state value, or indicating that the target data in the first data is not in the first state, thereby determining that the target data is valid.

[0157] In a possible implementation, if the client node determines that the third information indicates that the target data is locked, and / or the first information and the second information are different, then the client node determines that the target data is in the first state. Figure 5 Information shown in Figure c:

[0158] The third message: "1";

[0159] First message: 02;

[0160] Target data: xx;

[0161] Second message: 01;

[0162] It can be seen that the third information in the first data indicates that the target data in the first data is locked, and the first information and the second information in the first data are different, indicating that the verification information of the first data is set to the first state value, or indicating that the target data in the first data is in the first state, thereby determining that the target data is invalid.

[0163] Step 630: If the client node determines that the target data is not in the first state according to the verification information, then the target data is determined to be valid.

[0164] Step 640: If the client node determines that the target data is in the first state according to the verification information, the first data is discarded.

[0165] In this process, if the target data is not in the first state, it means that the target data is valid data, and further determines that the target data is allowed to be used when executing the business; if the target data is in the first state, it means that the target data is invalid data, and further determines that the target data is not allowed to be used when executing the business.

[0166] In one possible implementation, after abandoning the first data, the first data may be acquired again after a preset time, and then step 620 may be performed until the target data in the first data is determined to be valid. Optionally, after the number of times the first data is abandoned reaches a threshold, an alarm may be issued to notify the user that the target data in the first data has failed to be cached.

[0167] Based on the above technical solution, the client node does not perform a mutual exclusion operation before obtaining the first data from the server node. By directly obtaining the first data from the server node, the efficiency of the client node in obtaining data is improved, and the data transmission performance between the client node and the server node is improved. After the client node obtains the first data, it determines whether the target data is valid through the verification information in the first data, thereby ensuring the consistency and validity of the target data. In other words, the client node judges the validity and consistency of the data after obtaining the data, and does not need to perform a mutual exclusion operation to ensure the validity and consistency of the data before obtaining the data, thereby improving the data transmission performance between the client node and the server node. In addition, because no mutual exclusion operation is performed, the CPU of the client node is avoided from participating in the mutual exclusion operation, reducing the CPU resource overhead of the client node.

[0168] It is understood that in order to implement the functions in the above embodiments, the client node and the server node include hardware structures and / or software modules corresponding to the execution of each function. It should be readily apparent to those skilled in the art that, in combination with the units and method steps of the various examples described in the embodiments disclosed in this application, this application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in hardware or in a computer software-driven hardware manner depends on the specific application scenario and design constraints of the technical solution.

[0169] Figure 7 and Figure 8 Schematic diagram of the structure of possible data access devices provided by the embodiments of the present application. These data access devices can be used to implement the functions of the client node and the server node in the above method embodiments, and thus can also achieve the beneficial effects possessed by the above method embodiments. In the embodiments of the present application, if Figure 7 As shown, the data access device 700 includes an acquisition unit 710 and a processing unit 720. The data access device 700 is used to implement the above Figure 3 or Figure 6 The functions of the client node and the server node in the method embodiment are shown in FIG.

[0170] When the data access device 700 is used to implement Figure 3 The functions of the server node in the method embodiment shown are as follows: an acquisition unit 710 is used to receive a first request, wherein the first request indicates that target data is to be processed; a processing unit 720 is used to, in response to the first request, set the verification information of the target data to a first state value at the start time of processing the target data, process the target data, and set the verification information to a second state value at the completion time of processing the target data, wherein the first state value indicates that the target data is in a first state, and the first state indicates that the target data is in a transaction processing process.

[0171] In one possible implementation, the verification information includes first information and second information; the processing unit 720 is specifically used to: increment the value of the first information at the start time of processing the target data, and keep the value of the second information unchanged; increment the value of the second information at the completion time of processing the target data, and keep the value of the first information unchanged, and the second information after increment is the same as the first information.

[0172] In one possible implementation, the processed target data is stored as first data, the first data includes a first field, a second field and a data field, the first field carries the first information, the second field carries the second information, the data field carries the target data, the first field is located before the data field, and the second field is located after the data field.

[0173] In one possible implementation, the verification information includes first information, second information and third information, and the third information is used to indicate whether the target data is locked; the processing unit 720 is specifically used to: set the third information to a first value at the start of processing the target data, increment the value of the first information, keep the value of the second information unchanged, and the first value indicates that the target data is locked; increment the value of the second information at the completion of processing the target data, keep the value of the first information unchanged, set the third information to a second value, the incremented second information is the same as the first information, and the second value indicates that the target data is not locked.

[0174] In one possible implementation, the processed target data is stored as first data, the first data includes a first field, a second field and a data field, the first field carries the first information and the third information, the second field carries the second information, the data field carries the target data, the first field is located before the data field, and the second field is located after the data field.

[0175] In a possible implementation, the first information is a first serial number, and the second information is a second serial number.

[0176] When the data access device 700 is used to implement Figure 6 The functions of the client node in the method embodiment shown are as follows: an acquisition unit 710 is used to obtain first data from a server node, where the first data includes target data and verification information, and the verification information is used to determine whether the target data is in a first state, where the first state indicates that the target data is in a transaction processing process; a processing unit 720 is used to determine that the target data is valid when it is determined that the target data is not in the first state according to the verification information; and to abandon the first data when it is determined that the target data is in the first state according to the verification information.

[0177] In one possible implementation, the verification information includes first information and second information; the processing unit 720 is specifically used to: when it is determined that the first information and the second information are the same, determine that the target data is not in the first state; when it is determined that the first information and the second information are not the same, determine that the target data is in the first state.

[0178] In one possible implementation, the first data includes a first field, a second field and a data field, the first field carries the first information, the second field carries the second information, the data field carries the target data, the first field is located before the data field, and the second field is located after the data field.

[0179] In one possible implementation, the verification information includes first information, second information and third information, and the third information is used to indicate whether the target data is locked; the processing unit 720 is specifically used to: determine that the third information indicates that the target data is not locked, and when the first information and the second information are the same, determine that the target data is not in the first state; determine that the third information indicates that the target data is locked, and / or when the first information and the second information are different, determine that the target data is in the first state.

[0180] In one possible implementation, the first data includes a first field, a second field and a data field, the first field carries the first information and the third information, the second field carries the second information, the data field carries the target data, the first field is located before the data field, and the second field is located after the data field.

[0181] In a possible implementation, the first information is a first serial number, and the second information is a second serial number.

[0182] In a possible implementation, an RDMA connection is established between the client node and the server node; and the processing unit 720 is specifically configured to obtain the first data from the server node through the RDMA connection.

[0183] For more detailed description of the acquisition unit 710 and the processing unit 720, please refer to Figure 3 or Figure 6 The relevant description in the method embodiment shown is directly obtained and will not be repeated here.

[0184] like Figure 8 As shown, data access device 800 includes a processor 810 and an interface circuit 820. Processor 810 and interface circuit 820 are coupled to each other. It is understood that interface circuit 820 can be a transceiver or an input / output interface. Optionally, data access device 800 may further include a memory 830 for storing instructions executed by processor 810, input data required by processor 810 to execute instructions, or data generated after processor 810 executes instructions.

[0185] When the data access device 800 is used to implement Figure 3 or Figure 6 In the method shown, the processor 810 is used to implement the functions of the processing unit 720, and the interface circuit 820 is used to implement the functions of the acquisition unit 710.

[0186] When the data access device is a chip implemented in a client node, the chip implements the functionality of the client node in the method embodiments described above. The chip receives information from other modules in the client node (e.g., a radio frequency module or antenna), which is information sent by the server node to the client node; or the chip sends information to other modules in the client node (e.g., a radio frequency module or antenna), which is information sent by the client node to the server node.

[0187] When the data access device is a module applied to a server node, the module implements the functions of the server node in the above method embodiment. The module receives information from other modules in the server node (such as a radio frequency module or antenna), which is information sent by the client node to the server node; or the module sends information to other modules in the server node (such as a radio frequency module or antenna), which is information sent by the server node to the client node.

[0188] It is understood that the processor in the embodiments of the present application may be a central processing unit (CPU), or may be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field programmable gate arrays (FPGA), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. The general-purpose processor may be a microprocessor or any conventional processor.

[0189] In the present application, another example of a data access device is provided, which includes at least one processor and at least one memory. The at least one processor and the at least one memory are coupled, and the at least one memory is used to store instructions. When the instructions are executed by the at least one processor, the data access device 800 executes the method in the above embodiment. For example, the data access device 800 includes a processor and a memory. Figure 8As shown, the data access device 800 includes a processor 810 and a memory 830. The processor 810 and the memory 830 are coupled, and the memory 830 stores instructions. When the instructions stored in the memory 830 are executed by the processor 810, the data access device 800 executes the method executed by the terminal device or network device in the above embodiment.

[0190] The method steps in the embodiments of the present application can be implemented in hardware or in software instructions that can be executed by a processor. The software instructions can be composed of corresponding software modules, and the software modules can be stored in random access memory, flash memory, read-only memory, programmable read-only memory, erasable programmable read-only memory, electrically erasable programmable read-only memory, registers, hard disk, mobile hard disk, CD-ROM or any other form of storage medium well known in the art. An exemplary storage medium is coupled to the processor so that the processor can read information from the storage medium and write information to the storage medium. The storage medium can also be an integral part of the processor. The processor and storage medium can be located in an ASIC. In addition, the ASIC can be located in a network device or a terminal. The processor and storage medium can also exist in a network device or a terminal as discrete components.

[0191] In the above embodiments, all or part of the embodiments may be implemented using software, hardware, firmware, or any combination thereof. When implemented using software, all or part of the embodiments may be implemented in the form of a computer program product. The computer program product includes one or more computer programs or instructions. When the computer program or instructions are loaded and executed on a computer, the processes or functions described in the embodiments of the present application are performed in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, a network device, a user device, or other programmable device. The computer program or instructions may be stored in a computer-readable storage medium or transferred from one computer-readable storage medium to another. For example, the computer program or instructions may be transferred from one website, computer, server, or data center to another website, computer, server, or data center via wired or wireless means. The computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server or data center that integrates one or more available media. The available medium may be a magnetic medium, such as a floppy disk, hard disk, or magnetic tape; an optical medium, such as a digital video disk; or a semiconductor medium, such as a solid-state drive. The computer-readable storage medium may be a volatile or nonvolatile storage medium, or may include both volatile and nonvolatile types of storage media.

[0192] In the various embodiments of the present application, unless otherwise specified or there is a logical conflict, the terms and / or descriptions between different embodiments are consistent and can be referenced by each other. The technical features in different embodiments can be combined to form new embodiments according to their inherent logical relationships.

[0193] In this application, "at least one" means one or more, and "more" means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. In the text description of this application, the character " / " generally indicates that the previous and next associated objects are in an "or" relationship; in the formula of this application, the character " / " indicates that the previous and next associated objects are in a "division" relationship. "Including at least one of A, B and C" can mean: including A; including B; including C; including A and B; including A and C; including B and C; including A, B and C.

[0194] It is understood that the various numbers used in the embodiments of this application are merely for ease of description and are not intended to limit the scope of the embodiments of this application. The order of the sequence numbers of the above-mentioned processes does not necessarily imply a specific order of execution; the order of execution of the processes should be determined by their functions and inherent logic.

Claims

1. A data acquisition method, characterized in that: include: The client node obtains first data from the server node, where the first data includes target data and verification information, where the verification information is used to determine whether the target data is in a first state, where the first state indicates that the target data is in a transaction processing process; If the client node determines, based on the verification information, that the target data is not in the first state, then determining that the target data is valid; If the client node determines that the target data is in the first state according to the verification information, the first data is discarded.

2. The method according to claim 1, characterized in that The verification information includes first information and second information; The client node determining, according to the verification information, that the target data is not in the first state includes: If the client node determines that the first information and the second information are the same, then determining that the target data is not in the first state; The client node determines, according to the verification information, that the target data is in the first state, including: If the client node determines that the first information and the second information are different, it determines that the target data is in a first state.

3. The method according to claim 2, characterized in that The first data includes a first field, a second field and a data field, the first field carries the first information, the second field carries the second information, the data field carries the target data, the first field is located before the data field, and the second field is located after the data field.

4. The method according to claim 1, wherein The verification information includes first information, second information and third information, wherein the third information is used to indicate whether the target data is locked; The client node determining, according to the verification information, that the target data is not in the first state includes: If the client node determines that the third information indicates that the target data is not locked, and the first information and the second information are the same, then determining that the target data is not in the first state; The client node determines, according to the verification information, that the target data is in the first state, including: If the client node determines that the third information indicates that the target data is locked, and / or the first information and the second information are different, it is determined that the target data is in the first state.

5. The method according to claim 4, characterized in that The first data includes a first field, a second field and a data field, the first field carries the first information and the third information, the second field carries the second information, the data field carries the target data, the first field is located before the data field, and the second field is located after the data field.

6. The method according to any one of claims 2 to 5, characterized in that: The first information is a first serial number, and the second information is a second serial number.

7. The method according to any one of claims 1 to 6, characterized in that An RDMA connection is established between the client node and the server node; The client node obtains first data from the server node, including: The client node obtains the first data from the server node through the RDMA connection.

8. A data storage method, characterized in that: include: The server node receives a first request, where the first request instructs processing of target data; In response to the first request, the server node sets the verification information of the target data to a first state value at the start of processing the target data, processes the target data, and sets the verification information to a second state value at the completion of processing the target data, wherein the first state value indicates that the target data is in a first state, and the first state indicates that the target data is in a transaction processing process.

9. The method according to claim 8, characterized in that The verification information includes first information and second information; The step of setting the verification information of the target data to a first state value at the start of processing the target data includes: The server node increments the value of the first information and keeps the value of the second information unchanged; The step of setting the verification information to a second state value at the completion time of processing the target data includes: The server node increments the value of the second information and keeps the value of the first information unchanged, so that the incremented second information is the same as the first information.

10. The method according to claim 9, characterized in that The processed target data is stored as first data, which includes a first field, a second field and a data field. The first field carries the first information, the second field carries the second information, and the data field carries the target data. The first field is located before the data field, and the second field is located after the data field.

11. The method according to claim 8, characterized in that The verification information includes first information, second information and third information, wherein the third information is used to indicate whether the target data is locked; The step of setting the verification information of the target data to a first state value at the start of processing the target data includes: The server node sets the third information to a first value, where the first value indicates that the target data is locked; The server node increments the value of the first information and keeps the value of the second information unchanged; The step of setting the verification information to a second state value at the completion time of processing the target data includes: The server node increments the value of the second information and keeps the value of the first information unchanged, so that the incremented second information is the same as the first information; The server node sets the third information to a second value, where the second value indicates that the target data is not locked.

12. The method according to claim 11, characterized in that The processed target data is stored as first data, which includes a first field, a second field and a data field. The first field carries the first information and the third information, the second field carries the second information, and the data field carries the target data. The first field is located before the data field, and the second field is located after the data field.

13. The method according to any one of claims 9 to 12, characterized in that: The first information is a first serial number, and the second information is a second serial number.

14. A device, characterized in that The method comprises a unit or module for executing the method according to any one of claims 1 to 7, or comprises a unit or module for executing the method according to any one of claims 8 to 13.

15. A device, characterized in that The system comprises one or more processors configured to execute the method according to any one of claims 1 to 7, or configured to execute the method according to any one of claims 8 to 13.

16. A readable storage medium, characterized in that The readable storage medium includes a program, and when the program is run on a device, the device is caused to execute the method according to any one of claims 1 to 9, or execute the method according to any one of claims 8 to 13.

17. A chip system, characterized in that: The chip system includes at least one chip and a memory, and the at least one chip is used to read and execute program instructions stored in the memory to implement the method as described in any one of claims 1 to 9, or to implement the method as described in any one of claims 8 to 13.

18. A program product, characterized in that When the program product is run on a device, the device is caused to execute the method according to any one of claims 1 to 9 or the method according to any one of claims 8 to 13.

Citation Information

Patent Citations

  • Data processing method and apparatus

    CN106557262A

  • Data processing method and device, storage medium and electronic equipment

    CN115203215A

  • End to end validation of data transformation accuracy

    US20150227595A1

  • Data transmission method and apparatus, terminal, network-side device, and storage medium

    US20230262664A1

  • Information transmission method and apparatus, device, and storage medium

    WO2024001515A1