Data acquisition method and device, storage medium and electronic device

CN119105879BActive Publication Date: 2026-10-23TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310688450.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-09
Publication Date
2026-10-23
Estimated Expiration
2043-06-09

AI Technical Summary

Technical Problem

[0005]本发明实施例提供了一种数据获取方法和装置、存储介质及电子设备,以至少解决现有的数据获取方法操作效率较低的技术问题

Benefits of technology

[0011]在本发明实施例中,接收数据获取请求,其中,数据获取请求用于获取与目标节点集合对应的目标节点数据,目标节点集合为目标分布式服务器中保存的节点集合;在从本地保存的参考节点集合中并未获取到目标节点数据的情况下,根据数据获取请求中携带的请求描述信息,确定对目标节点集合中的至少一个节点子集执行的数据获取操作的操作类型,其中,参考节点集合为根据目标分布式服务器预先返回的数据集合构建的节点集合;根据数据获取操作的操作类型,在请求队列中添加与至少一个节点子集对应的数据操作请求,其中,请求队列用于向目标分布式服务器异步发送数据操作请求;发送目标分布式服务器根据数据操作请求返回的目标节点数据,从而实现了对目标分布式服务器中的数据的获取。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119105879B_ABST
    Figure CN119105879B_ABST
Patent Text Reader

Abstract

The application discloses a data acquisition method and device, a storage medium and an electronic equipment. The method can be used for object storage and acquisition. The method comprises the following steps: receiving a data acquisition request; in the case that target node data is not acquired from a locally saved reference node set, determining an operation type of a data acquisition operation performed on at least one node subset in a target node set according to request description information carried in the data acquisition request, the reference node set being a node set constructed according to a data set returned by a target distributed server in advance; adding data operation requests corresponding to the at least one node subset in a request queue according to the operation type of the data acquisition operation; and sending target node data returned by the target distributed server according to the data operation requests. The application solves the technical problem of low operation efficiency of the existing data acquisition method.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computers, and more specifically, to a data acquisition method and apparatus, a storage medium, and an electronic device. Background Technology

[0002] When developers create methods to retrieve data from a data storage server, the granularity of operations is typically at the level of an entire data set. However, in many cases, actual development needs do not require the same operational configuration for the entire data set. For example, monitoring data changes for a target subset of a target data set.

[0003] However, because different subsets of data in a dataset often exist in a hierarchical relationship, monitoring changes in the lowest-level subset usually requires configuring monitoring operations for changes in other data subsets at different levels. This configuration significantly reduces data acquisition efficiency. In other words, existing data acquisition methods suffer from the technical problem of low operational efficiency.

[0004] There is currently no effective solution to the above problems. Summary of the Invention

[0005] The present invention provides a data acquisition method and apparatus, a storage medium and an electronic device, to at least solve the technical problem of low operational efficiency of existing data acquisition methods.

[0006] According to one aspect of the present invention, a data acquisition method is provided, comprising: receiving a data acquisition request, wherein the data acquisition request is used to acquire target node data corresponding to a target node set, the target node set being a node set stored in a target distributed server; when the target node data is not acquired from a locally stored reference node set, determining an operation type for a data acquisition operation to be performed on at least one subset of nodes in the target node set based on request description information carried in the data acquisition request, wherein the reference node set is a node set constructed based on a data set pre-returned by the target distributed server; adding a data operation request corresponding to the at least one subset of nodes to a request queue according to the operation type of the data acquisition operation, wherein the request queue is used to asynchronously send the data operation request to the target distributed server; and sending the target node data returned by the target distributed server according to the data operation request.

[0007] According to another aspect of the present invention, a data acquisition apparatus is also provided, comprising: a receiving unit, configured to receive a data acquisition request, wherein the data acquisition request is used to acquire target node data corresponding to a target node set, the target node set being a node set stored in a target distributed server; a determining unit, configured to, when the target node data is not acquired from a locally stored reference node set, determine, based on request description information carried in the data acquisition request, an operation type for performing a data acquisition operation on at least one subset of nodes in the target node set, wherein the reference node set is a node set constructed based on a data set pre-returned by the target distributed server; an asynchronous processing unit, configured to, based on the operation type of the data acquisition operation, add a data operation request corresponding to the at least one subset of nodes to a request queue, wherein the request queue is used to asynchronously send the data operation request to the target distributed server; and a sending unit, configured to send the target node data returned by the target distributed server according to the data operation request.

[0008] According to another aspect of the present invention, a computer-readable storage medium is also provided, wherein a computer program is stored in the computer program, and the computer program is configured to execute the above-described data acquisition method at runtime.

[0009] According to another aspect of the embodiments of this application, a computer program product is provided, the computer program product including a computer program / instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer program / instructions from the computer-readable storage medium, and executes the computer program / instructions, causing the computer device to perform the data acquisition method as described above.

[0010] According to another aspect of the present invention, an electronic device is also provided, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to execute the data acquisition method described above through the computer program.

[0011] In this embodiment of the invention, a data acquisition request is received, wherein the data acquisition request is used to acquire target node data corresponding to a target node set, and the target node set is a set of nodes stored in the target distributed server; if the target node data is not acquired from a locally stored reference node set, the operation type of the data acquisition operation to be performed on at least one subset of nodes in the target node set is determined according to the request description information carried in the data acquisition request, wherein the reference node set is a set of nodes constructed based on a data set pre-returned by the target distributed server; according to the operation type of the data acquisition operation, a data operation request corresponding to at least one subset of nodes is added to the request queue, wherein the request queue is used to asynchronously send the data operation request to the target distributed server; the target node data returned by the target distributed server according to the data operation request is sent, thereby realizing the acquisition of data in the target distributed server.

[0012] In the above embodiments of this application, the received data acquisition request may include specific request description information. The request description information carries the operation type of the data acquisition operation corresponding to each of the multiple node subsets in the target node set. This allows for refined processing of the node subsets based on their respective operations, thereby avoiding repeated acquisition operations using the same acquisition method for the entire target node set and improving data acquisition efficiency. Furthermore, in the above embodiments, the data to be acquired can be queried locally first. If the data is not found, a data acquisition request is then sent to the target distributed server, thereby reducing the average latency of the data acquisition operation. Additionally, by adding corresponding operation requests to the request queue based on the operation type of the data acquisition operation, asynchronous processing of the data acquisition request can be achieved, avoiding processing delays caused by high concurrency processing and improving the operational efficiency of the data acquisition operation. This solves the technical problem of low operational efficiency in existing data acquisition methods. Attached Figure Description

[0013] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this application, illustrate exemplary embodiments of the invention and, together with their description, serve to explain the invention and do not constitute an undue limitation thereof. In the drawings:

[0014] Figure 1 This is a schematic diagram of the hardware environment for an optional data acquisition method according to an embodiment of the present invention;

[0015] Figure 2 This is a flowchart of an optional data acquisition method according to an embodiment of the present invention;

[0016] Figure 3 This is a schematic diagram of an optional data acquisition method according to an embodiment of the present invention;

[0017] Figure 4 This is a schematic diagram of another optional data acquisition method according to an embodiment of the present invention;

[0018] Figure 5 This is a flowchart of another optional data acquisition method according to an embodiment of the present invention;

[0019] Figure 6 This is a flowchart of another optional data acquisition method according to an embodiment of the present invention;

[0020] Figure 7 This is a flowchart of another optional data acquisition method according to an embodiment of the present invention;

[0021] Figure 8 This is a schematic diagram of the structure of an optional data acquisition device according to an embodiment of the present invention;

[0022] Figure 9 This is a schematic diagram of the structure of an optional electronic device according to an embodiment of the present invention. Detailed Implementation

[0023] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0024] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0025] The following explains the technical terms used in this application:

[0026] Cloud storage is a new concept that extends and develops from the concept of cloud computing. A distributed cloud storage system (hereinafter referred to as a storage system) refers to a storage system that uses cluster applications, grid technology and distributed storage file systems to bring together a large number of storage devices of various types in the network (storage devices are also called storage nodes) to work together through application software or application interfaces to provide data storage and business access functions to the outside world.

[0027] Currently, the storage method of storage systems is as follows: Logical volumes are created. During the creation of a logical volume, physical storage space is allocated to each logical volume. This physical storage space may consist of a single storage device or the disks of several storage devices. Clients store data on a logical volume, which means storing the data on the file system. The file system divides the data into many parts, each part being an object. Each object contains not only the data but also additional information such as a data identifier (ID, ID entity). The file system writes each object to the physical storage space of that logical volume, and it records the storage location information of each object. Therefore, when a client requests access to data, the file system can allow the client to access the data based on the storage location information of each object.

[0028] The process by which a storage system allocates physical storage space to a logical volume is as follows: the physical storage space is pre-divided into strips according to the capacity estimate of the objects stored in the logical volume (this estimate often has a large margin relative to the actual capacity of the objects to be stored) and the grouping of Redundant Array of Independent Disks (RAID). A logical volume can be understood as a strip, thus allocating physical storage space to the logical volume.

[0029] ZK: Short for ZooKeeper server;

[0030] ZK path: Data in ZooKeeper is stored in a tree structure. Each node can have child nodes and can also store a string of data. The data nodes stored in ZooKeeper can be explicitly identified through the ZK path.

[0031] Incremental events: These refer to changes to child nodes or data on a ZooKeeper path that are recorded as incremental events. An incremental event describes the changes that occur on the ZooKeeper path when this event occurs. Examples include adding or deleting a child node.

[0032] Watch callback: refers to a callback set for an event change of a specified ZooKeeper path through the ZooKeeper interaction protocol;

[0033] unwatch: This means marking a ZooKeeper path as uninteresting, so that when an event occurs on this path again, no further processing will be performed.

[0034] ZooKeeper events refer to events that occur in ZooKeeper, such as changes to child nodes, data changes, path deletion, session timeouts, etc.

[0035] According to one aspect of the present invention, a data acquisition method is provided. As an optional implementation, the above-described data acquisition method may be applied to, but is not limited to, [examples of other methods]. Figure 1 The data acquisition system in the hardware environment shown may include, but is not limited to, terminal device 102, network 104, server 106, and database 108. Terminal device 102 runs a target client (e.g., ...). Figure 1 As shown, taking the target client as an example, which can obtain target node data from a set of nodes in the target server. The aforementioned terminal device 102 includes a human-computer interaction screen, a processor, and a memory. The human-computer interaction screen is used to display the data acquisition operation interface and also to provide a human-computer interaction interface to receive human-computer interaction operations for controlling the controlled virtual character in the virtual scene. The processor is used to generate interaction instructions in response to the aforementioned human-computer interaction operations and send the data operation request corresponding to the interaction instructions to the server. The memory is used to store the node set constructed from the data set pre-returned by the target distributed server.

[0036] In addition, server 106 includes a processing engine for performing store or read operations on database 108. Specifically, the processing engine reads node data from each node in the node set from database 108.

[0037] Assumption Figure 1 The terminal device 102 runs a client for acquiring target node data. The specific process of this embodiment is as follows: as in steps S102 to S106, a data acquisition request is received, wherein the data acquisition request is used to acquire target node data corresponding to the target node set, and the target node set is a set of nodes stored in the target distributed server; if the target node data is not acquired from the locally stored reference node set, the operation type of the data acquisition operation to be performed on at least one subset of nodes in the target node set is determined according to the request description information carried in the data acquisition request, wherein the reference node set is a set of nodes constructed based on the data set pre-returned by the target distributed server; according to the operation type of the data acquisition operation, a data operation request corresponding to at least one subset of nodes is added to the request queue, wherein the request queue is used to asynchronously send the data operation request to the target distributed server;

[0038] Next, as in step S108, terminal device 102 sends a data operation request to server 106 via network 104. Server 106 executes steps S110 and S112, queries the target node data matching the data operation request in the target node set, and sends the target node data to terminal device 102 via network 104. Finally, terminal device 102 executes step S114, sending the target node data returned by the target distributed server according to the data operation request.

[0039] Optionally, in this embodiment, the terminal device 102 can be a terminal device configured with a target client, which may include, but is not limited to, at least one of the following: mobile phone (such as Android phone, iOS phone, etc.), laptop computer, tablet computer, PDA, MID (Mobile Internet Devices), PAD, desktop computer, smart TV, etc. The target client can be a video client, instant messaging client, browser client, educational client, or other client that supports providing shooting game tasks. The network may include, but is not limited to, wired network and wireless network, wherein the wired network includes: local area network, metropolitan area network, and wide area network, and the wireless network includes: Bluetooth, WIFI, and other networks that enable wireless communication. The server may be a single server, a server cluster composed of multiple servers, or a cloud server. The above is only an example, and no limitation is made in this embodiment.

[0040] The server can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The terminal can be a smartphone, tablet, laptop, desktop computer, smart speaker, smartwatch, etc., but is not limited to these. The terminal and server can be connected directly or indirectly through wired or wireless communication methods, which is not limited herein.

[0041] In this embodiment of the invention, a data acquisition request is received, wherein the data acquisition request is used to acquire target node data corresponding to a target node set, and the target node set is a set of nodes stored in the target distributed server; if the target node data is not acquired from a locally stored reference node set, the operation type of the data acquisition operation to be performed on at least one subset of nodes in the target node set is determined according to the request description information carried in the data acquisition request, wherein the reference node set is a set of nodes constructed based on a data set pre-returned by the target distributed server; according to the operation type of the data acquisition operation, a data operation request corresponding to at least one subset of nodes is added to the request queue, wherein the request queue is used to asynchronously send the data operation request to the target distributed server; the target node data returned by the target distributed server according to the data operation request is sent, thereby realizing the acquisition of data in the target distributed server.

[0042] In the above embodiments of this application, the received data acquisition request may include specific request description information. The request description information carries the operation type of the data acquisition operation corresponding to each of the multiple node subsets in the target node set. This allows for refined processing of the node subsets based on their respective operations, thereby avoiding repeated acquisition operations using the same acquisition method for the entire target node set and improving data acquisition efficiency. Furthermore, in the above embodiments, the data to be acquired can be queried locally first. If the data is not found, a data acquisition request is then sent to the target distributed server, thereby reducing the average latency of the data acquisition operation. Additionally, by adding corresponding operation requests to the request queue based on the operation type of the data acquisition operation, asynchronous processing of the data acquisition request can be achieved, avoiding processing delays caused by high concurrency processing and improving the operational efficiency of the data acquisition operation. This solves the technical problem of low operational efficiency in existing data acquisition methods.

[0043] As an optional implementation method, such as Figure 2 As shown, the above data acquisition method includes the following steps:

[0044] S202, Receive a data acquisition request, wherein the data acquisition request is used to acquire target node data corresponding to the target node set, and the target node set is the set of nodes stored in the target distributed server;

[0045] S204, if the target node data is not obtained from the locally stored reference node set, determine the operation type of the data acquisition operation to be performed on at least one subset of nodes in the target node set based on the request description information carried in the data acquisition request, wherein the reference node set is a set of nodes constructed based on the data set pre-returned by the target distributed server;

[0046] S206, Based on the operation type of the data acquisition operation, add a data operation request corresponding to at least one subset of nodes to the request queue, wherein the request queue is used to asynchronously send data operation requests to the target distributed server;

[0047] S208, Send the target node data returned by the target distributed server based on the data operation request.

[0048] It should be noted that the above implementation method can be applied to a terminal, where a client runs. This client can respond to user requests to retrieve data from data nodes in the target distributed server. In one specific embodiment, the target distributed server can be a ZooKeeper server.

[0049] In step S202 above, the data acquisition request can be used to acquire target node data corresponding to the target node set. The target node set can be a set of nodes composed of data nodes in the target node tree stored in the ZooKeeper server. The data type of the target node data corresponding to the target node set can include, but is not limited to, node data stored in each data node in the target node set, and can also be the child node data corresponding to each data node.

[0050] More specifically, the target node data mentioned above may include node data corresponding to different subsets of nodes in the target node set. For example, the target node set may include subset A, subset B, and subset C. The target node data may indicate a set consisting of a first data set composed of node data stored in each node in subset A, a second data set composed of node identifiers of child nodes corresponding to each node in subset B, and a third data set composed of node data stored in each node in subset C and node identifiers of child nodes of each node in subset C. In another embodiment, the node data may also be used to indicate node change data corresponding to each node subset, such as newly added node data stored in a node, or node identifiers of newly added child nodes corresponding to a node. In this embodiment, the specific content included in the target node data is not limited.

[0051] Further, in step S204 above, the request description information can be used to indicate the operation type of the data acquisition request for each subset of nodes in the target node set. For example, the data acquisition operation may include, but is not limited to, node data acquisition operation, node child node acquisition operation, node data monitoring operation, and node child node monitoring operation. The monitoring operation indicates a data acquisition method that acquires the changed relevant data when the node data or node child node data changes in the server. In an optional manner, the data acquisition operation for a subset of nodes may include a combination of one or more of the above operations. In this embodiment, the operation type of the data acquisition operation is not limited.

[0052] Understandably, in another alternative approach, after receiving a data retrieval request, the relevant data can first be queried from a locally stored set of reference nodes. If the query is successful, the target node data can be determined based on the query results. Here, the set of reference nodes is a set of nodes constructed based on the data set pre-returned by the target distributed server.

[0053] In step S206 above, a data operation request corresponding to at least one subset of nodes can be added to the request queue according to the operation type of the data acquisition operation. The request queue is used to asynchronously send data operation requests to the target distributed server.

[0054] It should be noted that the method of adding data operation requests according to the operation type of data acquisition operation can be, but is not limited to, adding one type of data operation request to the request queue for one type of data acquisition operation; or, when the data acquisition operation includes multiple sub-operations, adding multiple sub-operations corresponding to each sub-operation to the request queue. In this embodiment, the above-mentioned method of adding data operation requests is not limited.

[0055] Finally, in step S208 above, the target node data can be sent after obtaining the target node data returned by the target distributed server according to the data operation request. In one embodiment, if the terminal performing the above operation and the data requesting terminal sending the data acquisition request are different terminals, the sending operation can be to send the target node data to the data requesting terminal via the network; if the terminal performing the above operation and the terminal sending the data acquisition request are the same terminal, the sending operation can be to send the target node data to another data receiving interface through a processing module within the client.

[0056] The following section provides a detailed explanation of the technical problems that this application can solve, using the ZK development scenario as an example.

[0057] Current applications developed based on ZooKeeper (ZK) fetch data or register watches at the ZK path granularity, performing synchronous or asynchronous data retrieval and returning the data, while simultaneously executing corresponding business logic for each returned data item. For example, consider the following data in ZK:

[0058] path: / A / B; child nodes of this path: C1, C2, C3...Cn; each child node has child nodes: D1, D2, D3...Dn;

[0059] One application's logic is to start retrieving child nodes from the path " / A / B". If a child node exists, it then retrieves its grandchildren. This continues until all data is retrieved. A watch callback for the `childrenchange` event is set on " / A / B" to detect changes in its child nodes. Similarly, watch callbacks for the `childrenchange` event are set on the child nodes along this path to detect changes in their grandchildren. However, the actual data needed by the application is the final layer: D1, D2, D3...Dn.

[0060] In the above process, even when using data from Dx, it's still necessary to implement the watch callback of the layer above Dx and perform some code development to retrieve Dx. If there are multiple intermediate layers, the number of watch callbacks required will increase. However, these are essentially generic implementations. Existing solutions lack batch processing, resulting in low efficiency. For example, when retrieving Dx data, if there are 10,000 Cx nodes, the first full data retrieval will require at least 10,000 function calls to process the child nodes Dx retrieved from each Cx node, even if the data can be aggregated. Therefore, the current data retrieval methods in ZooKeeper development scenarios suffer from low data retrieval efficiency.

[0061] In this embodiment of the invention, a data acquisition request is received, wherein the data acquisition request is used to acquire target node data corresponding to a target node set, and the target node set is a set of nodes stored in the target distributed server; if the target node data is not acquired from a locally stored reference node set, the operation type of the data acquisition operation to be performed on at least one subset of nodes in the target node set is determined according to the request description information carried in the data acquisition request, wherein the reference node set is a set of nodes constructed based on a data set pre-returned by the target distributed server; according to the operation type of the data acquisition operation, a data operation request corresponding to at least one subset of nodes is added to the request queue, wherein the request queue is used to asynchronously send the data operation request to the target distributed server; the target node data returned by the target distributed server according to the data operation request is sent, thereby realizing the acquisition of data in the target distributed server.

[0062] In the above embodiments of this application, the received data acquisition request may include specific request description information. The request description information carries the operation type of the data acquisition operation corresponding to each of the multiple node subsets in the target node set. This allows for refined processing of the node subsets based on their respective operations, thereby avoiding repeated acquisition operations using the same acquisition method for the entire target node set and improving data acquisition efficiency. Furthermore, in the above embodiments, the data to be acquired can be queried locally first. If the data is not found, a data acquisition request is then sent to the target distributed server, thereby reducing the average latency of the data acquisition operation. Additionally, by adding corresponding operation requests to the request queue based on the operation type of the data acquisition operation, asynchronous processing of the data acquisition request can be achieved, avoiding processing delays caused by high concurrency processing and improving the operational efficiency of the data acquisition operation. This solves the technical problem of low operational efficiency in existing data acquisition methods.

[0063] In one optional implementation, the operation type for determining the data acquisition operation to be performed on at least one subset of nodes in the target node set based on the request description information carried in the data acquisition request includes:

[0064] S1, obtain the node path information in the request description information, wherein the node path information is used to indicate the node path of the target node tree, and the target node set is the node set composed of data nodes in the target node tree;

[0065] S2, obtain at least one operation identifier from the request description information, wherein the operation identifier is used to indicate the operation type of the data acquisition operation, and at least one node subset is a set of nodes consisting of data nodes in at least one layer of nodes;

[0066] S3, determine the operation type of the data acquisition operation corresponding to at least one layer of nodes based on at least one operation identifier.

[0067] It should be noted that when the target node set is a set of nodes in the target node tree stored in the target distributed server, the above node path information can be used to indicate the target node tree. For example... Figure 3 As shown, node A is the root node of a node tree, node B is a child node of node A, nodes C1, C2, and C3 are child nodes of node B, nodes D1 and D2 are child nodes of node C1, node D3 is a child node of node C2, and nodes D4 and D5 are child nodes of node C3. When the data acquisition request is used to acquire target node data corresponding to the target node set composed of nodes C1, C2, C3, D1, D2, D3, D4, and D5, it can be determined that the target node tree corresponding to the above node set is a node tree composed of the child nodes corresponding to node B. Therefore, the node path information of the above target node tree can be determined as A\B. This node tree is identified by the sequence of its preceding nodes, meaning the initial node of the node tree is node B.

[0068] Furthermore, an operation identifier in the aforementioned request description information can be used to indicate the operation type of the data acquisition operation corresponding to a first-level node. In one optional approach, the aforementioned first-level node can be used to indicate multiple nodes with the same hierarchical relationship. For example, C1, C2, and C3 are first-level nodes, and D1, D2, D3, D4, and D5 are first-level nodes. Thus, in this embodiment, the granularity of the operation performed on the node set can include a first subset composed of C1, C2, and C3, and a second subset composed of D1, D2, D3, D4, and D5. In another optional approach, the aforementioned first-level node can also be used to indicate multiple sibling child nodes belonging to the same node. For example, C1, C2, and C3 are all child nodes of node B, and can therefore be identified as multiple sibling child nodes belonging to the same node; nodes D1 and D2 are child nodes belonging to node C1, node D3 is a child node belonging to node C2, and nodes D4 and D5 are child nodes belonging to node C3. Therefore, in this embodiment, the granularity of operations performed on the node set can include a first subset consisting of C1, C2, and C3, a second subset consisting of D1 and D2, a third subset consisting of D3, and a fourth subset consisting of D4 and D5. It is understood that each level of nodes can correspond to an operation identifier, thereby determining whether to perform the same node operation on that level of nodes.

[0069] Through the above-described embodiments of this application, node path information in the request description information is obtained; at least one operation identifier in the request description information is obtained; the operation type of the data acquisition operation corresponding to at least one layer of nodes is determined according to the at least one operation identifier, thereby refining the node subset according to the operation corresponding to each node subset, thereby avoiding repeated acquisition operations using the same acquisition method for the entire target node set and improving data acquisition efficiency.

[0070] In one optional implementation, the operation type for determining the data acquisition operation corresponding to at least one layer of nodes based on at least one operation identifier includes at least one of the following:

[0071] When the operation identifier is the first identifier, it is determined that the data acquisition operation is used to acquire the set of nodes consisting of the child nodes of each node in at least one layer of nodes, and to monitor the change status of the child nodes corresponding to each node in at least one layer of nodes.

[0072] When the operation identifier is the second identifier, it is determined that the data acquisition operation is used to acquire the node data stored in each node in at least one layer of nodes, and to monitor the data changes of the node data stored in each node in at least one layer of nodes;

[0073] When the operation identifier is the third identifier, it is determined that the data acquisition operation is used to acquire the set of nodes composed of the child nodes of each node in at least one layer of nodes, monitor the change status of the corresponding child nodes of each node in at least one layer of nodes, acquire the node data stored in each node in at least one layer of nodes, and monitor the data changes of the node data stored in each node in at least one layer of nodes.

[0074] When the operation identifier is the fourth identifier, it is determined that the data acquisition operation is used to acquire the set of nodes consisting of the child nodes of each node in at least one level of nodes;

[0075] When the operation identifier is the fifth identifier, it is determined that the data acquisition operation is used to acquire the node data stored in each node in at least one layer of nodes;

[0076] When the operation identifier is the sixth identifier, it is determined that the data acquisition operation is used to acquire the set of nodes consisting of the child nodes of each node in at least one layer of nodes, and to acquire the node data stored in each node in at least one layer of nodes.

[0077] It is understood that, in this embodiment, different operation identifiers can be used to indicate the operation type of the corresponding data acquisition operation for multi-level nodes.

[0078] In one specific approach, the above request description information can be organized in a tree-like structure. Specifically, the data retrieval request content in the tree-like description includes the rootPath and watchTypes parameters, with the following meanings:

[0079] 1. rootPath: Used to identify the initial node of the current request;

[0080] 2. watchTypes: Describes the operations (watchTypes) that need to be performed by each ZooKeeper node at each layer. The operation types (watchTypes) include:

[0081] (1) Retrieve and set the children change event callback;

[0082] (2) Retrieve and set the value change (node ​​data change) event callback;

[0083] (3) Retrieve and set the callbacks for the children change and value change events;

[0084] (4) Only fetch the child nodes of the current node;

[0085] (5) Only fetch data from the current node;

[0086] (6) Retrieve the child nodes and data of the current node.

[0087] It is understandable that the above monitoring operations can be implemented by setting a callback. Specifically, the callback setting operation can be set on the ZK server, so that when the ZK server detects the corresponding event, it returns the relevant data to the local machine.

[0088] Through the above-described embodiments of this application, node path information in the request description information is obtained; at least one operation identifier in the request description information is obtained; the operation type of the data acquisition operation corresponding to at least one layer of nodes is determined according to the at least one operation identifier, thereby refining the node subset according to the operation corresponding to each node subset, thereby avoiding repeated acquisition operations using the same acquisition method for the entire target node set and improving data acquisition efficiency.

[0089] In one optional implementation, adding a data operation request corresponding to at least one subset of nodes to the request queue based on the operation type of the data acquisition operation includes:

[0090] When the operation type of the data acquisition operation indicates that the data acquisition operation includes a node data pull sub-operation, an asynchronous pull operation request is added to the request queue. The node data pull sub-operation is used to obtain node-related data corresponding to at least one node subset. The node-related data includes node data stored in the data nodes in the node subset and / or the reference node subset corresponding to each data node in the node subset.

[0091] If the operation type of the data acquisition operation indicates that the data acquisition operation includes a node data monitoring sub-operation, an asynchronous data monitoring operation request is added to the request queue. The node data monitoring sub-operation is used to obtain the changes in the node-related data corresponding to at least one subset of nodes.

[0092] It is understood that, in this embodiment, adding a data operation request corresponding to at least one subset of nodes to the request queue based on the operation type of the data acquisition operation can be done by adding an asynchronous request to the request queue based on the operation type of the sub-operations included in the data acquisition operation.

[0093] In this embodiment, if the target node data is not obtained from the locally stored set of reference nodes, a corresponding data operation request can be added to the request queue based on the operation type of the data acquisition operation. For example, such as Figure 3 As shown, when the data retrieval operation for node subsets C1, C2, and C3 is "fetch and set the callbacks for the children change and value change events", the following data operation request can be added to the request queue:

[0094] 1. Retrieve changes to the child nodes of C1, C2, and C3;

[0095] 2. Retrieve changes in node data for C1, C2, and C3;

[0096] 3. Set the callback for the children change event of C1, C2, and C3;

[0097] 4. Set the callback for the value change event of C1, C2, and C3.

[0098] Therefore, during the process of sending a request to the server, a type of data acquisition operation targeting the same layer of nodes is broken down into more granular operation requests.

[0099] Through the above-described embodiments of this application, the node subsets are processed in a more refined manner according to the corresponding operations of each node subset, and more refined data requests are generated. This avoids repeated acquisition operations using the same acquisition method for the entire target node set, thereby improving data acquisition efficiency.

[0100] In one optional implementation, after receiving the data acquisition request, the method further includes:

[0101] S1, if the target node data is obtained from the locally stored set of reference nodes, send the target node data;

[0102] S2, based on the request description information carried in the data acquisition request, determine the operation type of the data acquisition operation to be performed on at least one subset of nodes in the target node set;

[0103] S3, if the operation type of the data acquisition operation indicates that the data acquisition operation includes a node data monitoring sub-operation, add an asynchronous data monitoring operation request to the request queue. The node data monitoring sub-operation is used to obtain the changes in the node-related data corresponding to at least one node subset. The node-related data includes the node data stored in the data nodes in the node subset, and / or the reference node subset corresponding to each data node in the node subset.

[0104] It is understood that, in this embodiment, when the target node data is obtained from the locally stored set of reference nodes, the request description information carried in the data acquisition request can be further obtained, so as to add an asynchronous data monitoring operation request corresponding to the node data monitoring sub-operation in the request queue according to the node data monitoring sub-operation indicated in the request description information.

[0105] In one optional implementation, if the request description information carried in the received data acquisition request indicates that different data acquisition operations should be performed on different subsets of nodes, a data query can be performed first from the local reference node set. If some node data in the target node data is found, then the corresponding asynchronous pull operation request can be added to the request queue based on the node data that was not found. If the request description information carried in the received data acquisition request indicates that node data monitoring sub-operations should be performed on the subset of nodes, an asynchronous data monitoring operation request can be added to the request queue at the same time.

[0106] Through the above-described implementation method of this application, by simply passing in the root node and describing how each level needs to be operated (setting a watch (data callback) or simply fetching data), and marking the paths that need to be merged for events as needed, and passing in an event callback method, the data of the entire tree can be obtained and returned at once, avoiding multiple calls and improving the efficiency of data retrieval operations.

[0107] In an optional implementation, after adding the data operation request corresponding to at least one subset of nodes to the request queue, the method further includes:

[0108] S1, if the request queue includes data operation requests that have not yet been sent, retrieve a data operation request from the request queue as the current operation request, and asynchronously send the current operation request to the target distributed server;

[0109] S2, add the current response request corresponding to the current operation request to the return queue. The return queue stores response requests corresponding to multiple responses for which response data has not yet been obtained. The current response request is used to obtain the response data returned by the target distributed server in response to the current operation request.

[0110] S3, upon receiving response data from the target distributed server, removes the current response request from the return queue and determines the target node data based on the response data.

[0111] It is understandable that in this embodiment, asynchronous request sending can be implemented by setting up an asynchronous task queue module. Specifically, in this embodiment, all ZooKeeper requests are made asynchronous. The asynchronous task queue module is the unified management module for these tasks. It mainly performs the following functional tasks.

[0112] First, the asynchronous task queue module can be used to receive asynchronous ZooKeeper requests:

[0113] The system receives asynchronous ZooKeeper (ZK) requests, assigns each request a globally unique jobId, and applies appropriate request rate limiting based on the set concurrency level. Then, it sends the request to the ZK sending thread. Finally, it adds the current jobId to the queue awaiting a response.

[0114] Secondly, the asynchronous task queue module can be used to receive asynchronous data callbacks:

[0115] The system receives asynchronous data fetch responses from the ZooKeeper receiving thread. Upon receiving the asynchronous data fetch response request, it obtains the jobId, removes the previously placed job from the waiting response queue, and then sends the data back. It waits for the main logic module to complete processing. Then, it checks if there are any pending request tasks; if so, it retrieves one request and sends it to the ZooKeeper sending module.

[0116] In addition, a zk request sending module can be configured to send requests in the queue. Specifically, the zk request sending module accepts zk requests from the task queue module, encapsulates the zk request data packets, and sends the data packets to the zk server over the network.

[0117] Through the above-described embodiments of this application, when the request queue includes unsent data operation requests, a data operation request is retrieved from the request queue as the current operation request and asynchronously sent to the target distributed server. A current response request corresponding to the current operation request is added to the return queue, wherein the return queue stores response requests corresponding to multiple unreceived response data, and the current response request is used to obtain the response data returned by the target distributed server in response to the current operation request. Upon receiving the response data returned by the target distributed server, the current response request is deleted from the return queue, and the target node data is determined based on the response data. This accelerates ZooKeeper access in a fully asynchronous manner, improving data acquisition efficiency.

[0118] In one optional implementation, determining the target node data based on the response data includes:

[0119] S1, compare the node data included in the response data with the node data of the corresponding node subset in the reference node set to determine the node change data;

[0120] S2, when the current operation request is an asynchronous data monitoring operation request, determines the node change data as the target node data.

[0121] It should be noted that in this implementation, a global tree-structured storage can be implemented locally, storing the children and value data of the nodes corresponding to the watched ZooKeeper paths. This storage is updated when a ZooKeeper event is triggered, and when a ZooKeeper event callback occurs, it is compared with the latest data in ZooKeeper to generate incremental data.

[0122] In existing ZooKeeper development processes, due to the coarse granularity of data acquisition, developers can only perceive changes in events through data analysis after acquiring a large amount of data and then convert these events into incremental events. However, the implementation method described in this application compares the node data included in the response data with the node data of the corresponding subset of nodes in the reference node set to determine the node change data. In the case of an asynchronous data monitoring operation request, the node change data is identified as the target node data. This automatically transforms ZooKeeper events into corresponding incremental events during the event triggering process, avoiding reliance on developers to perceive events manually and thus improving the efficiency of data acquisition operations.

[0123] In an optional implementation, the above-mentioned steps of deleting the current response request from the return queue and using the response data as target node data upon receiving response data from the target distributed server further include:

[0124] S1, the operation type for retrieving data from the subset of nodes corresponding to the response data;

[0125] S2, if the operation type of the data acquisition operation indicates that the data acquisition operation includes a node data monitoring sub-operation, add an asynchronous data monitoring operation request to the request queue, wherein the node data monitoring sub-operation is used to obtain the changes in the node-related data corresponding to at least one subset of nodes.

[0126] It is understandable that in this embodiment, when the operation type of the data acquisition operation indicates that the changes in the node-related data need to be monitored, while receiving a change response event returned by the server, an asynchronous data monitoring operation request is added to the request queue, thereby realizing continuous monitoring of the changes in the node-related data of the node set in the server.

[0127] In an optional implementation, the above-mentioned steps of deleting the current response request from the return queue and using the response data as target node data upon receiving response data from the target distributed server further include:

[0128] S1, the operation type for retrieving data from the subset of nodes corresponding to the response data;

[0129] S2, where the operation type of the data acquisition operation indicates that the data acquisition operation includes a node data monitoring sub-operation, and the response data includes node-related data, node-related data is added to the locally stored set of reference nodes. The node data monitoring sub-operation is used to obtain the changes in the node-related data corresponding to at least one subset of nodes. The node-related data includes the node data stored in the nodes of the node subset, and / or the reference node subset corresponding to each node in the node subset.

[0130] It is understandable that in this embodiment, when the node corresponding to the acquired node data is a data node in a monitoring state, after obtaining the response data returned by the server, the acquired data can be stored locally so that when a related data request is received next time, the response can be made directly based on the locally stored data, thereby improving the data acquisition efficiency.

[0131] In an optional implementation, the process of receiving a data acquisition request further includes:

[0132] S1, Receive the first data acquisition request;

[0133] S2, if the request description information in the first data acquisition request indicates that the data acquisition operation performed on the first node subset includes the node data monitoring sub-operation, then based on the first node data obtained from the target distributed server, a first node tree corresponding to the first node subset is constructed locally. The first node tree is used to store the first node data. Each data node in the first node tree stores a child node field, a data field, and an invalidation field. The child node field is used to indicate the child node corresponding to the current data node, the data field is used to indicate the node data stored in the current data node, and the invalidation field is used to indicate the monitoring status of the current data node.

[0134] In one specific implementation, the above-described embodiments of this application can implement a global tree-like storage locally, storing the children and value data of the nodes corresponding to the watched (i.e., set to monitoring) ZooKeeper paths. This data is updated when a ZooKeeper event is triggered. The tree-like data storage structure can use, but is not limited to, multi-branch trees and multi-level maps, as long as it can describe a tree data structure. The data fields that the nodes on the path need to store include:

[0135] 1. children: The child nodes of the current path;

[0136] 2. value: The value of the current path;

[0137] 3. expire: Whether the current path has been unwatched (i.e., the nodes on this path are set to be uninterested, and when they receive an event from this path again, no further processing will be done).

[0138] Through the above-described implementation method of this application, based on tree-structured watch, developers only need to pass in the root node, and then describe how each level needs to be operated (setting a watch or simply pulling data). Then, the node subsets are refined according to the corresponding operations of each node subset, thereby avoiding repeated operations of using the same acquisition method for the entire target node set and improving data acquisition efficiency.

[0139] In an optional implementation, after creating a first node tree corresponding to the first node subset locally based on the first node data obtained from the target distributed server, the method further includes:

[0140] S1, Receive the second data acquisition request;

[0141] S2, if the request description information in the second data acquisition request indicates that the data operation performed on the first node subset includes canceling the node data monitoring sub-operation, then the failure field of each data node in the first node subset is marked as failed.

[0142] Specifically, in this embodiment, the aforementioned global tree-structured data storage object is mainly used for the following functions:

[0143] Function 1: When there is a zk event callback, compare it with the latest data on zk and generate incremental data.

[0144] Function 2: When a new request needs to fetch data from ZooKeeper, first check if it exists in the local storage. If it exists, retrieve the data directly and return it; otherwise, initiate an asynchronous request to ZooKeeper.

[0145] When an unwatch operation is performed on a ZooKeeper path, the expire field of the corresponding path in the local global data is first marked as true. When this path is watched again, the expire field of the corresponding path's data in the global tree storage is first checked to see if it is true. If it is, the expire field is directly marked as false, and the data is returned, thereby reducing ZooKeeper interactions and improving data retrieval efficiency.

[0146] The following combination Figure 4 , Figure 5 The system architecture of the method described above in this application will be explained.

[0147] like Figure 4As shown, the above-described implementation of this application can be used in scenarios involving ZK data retrieval and watch registration, which can greatly improve the efficiency of data retrieval and watch registration. For example, in a virtual network controller scenario, which includes a service side and an agent side, the service side writes data to ZooKeeper (i.e., ZooKeeper ob, ZooKeeper observer cluster in the diagram). The agent (client) retrieves data from ZooKeeper by watching the corresponding ZooKeeper path and using ZooKeeper's event notification mechanism, completes the business logic transformation, and finally distributes the configuration to the virtual switch.

[0148] An agent can include, for example: Figure 5 The four modules shown are: main logic module 501, asynchronous task queue module 502, zk request sending module 503, and zk data and event receiving module 504.

[0149] The main logic module 501 is the main business processing module in the technical implementation architecture of this application. All event callback processing, asynchronous data retrieval callback processing, and local data storage processing are implemented here. Specifically, it can be used to implement: global data storage and processing, receiving external requests and returning them synchronously, parsing requests and constructing asynchronous tasks, asynchronous data callback processing, and event callback processing.

[0150] In addition, the main logic module 501 is also a module that provides interfaces to the outside world. Although it is fully asynchronous internally, the external interfaces are all synchronous interfaces.

[0151] The asynchronous task queue module 502 is used for unified management of asynchronous tasks, including receiving asynchronous ZooKeeper requests and receiving asynchronous data callbacks;

[0152] Specifically, receiving asynchronous ZooKeeper requests involves accepting asynchronous ZooKeeper request tasks sent from the main logic module, assigning each request a globally unique jobId, and implementing reasonable request rate limiting based on the set request concurrency level. Then, the request is sent to the ZooKeeper sending thread. Finally, the current jobId is placed in the queue waiting for a response.

[0153] The asynchronous data callback receiving function can receive asynchronous data fetch returns from the ZooKeeper receiving thread. Upon receiving the asynchronous data fetch return request, it obtains the jobId, removes the job previously placed in the waiting return queue from the waiting return queue, and sends the data back to the main logic module. It then waits for the main logic module to complete processing. Next, it checks if there are any pending request tasks; if so, it retrieves one request and sends it to the ZooKeeper sending module.

[0154] The zk request sending module 503 receives zk requests from the task queue module, encapsulates the zk request data packets, and sends the data packets to the zk server over the network.

[0155] The zk data and event receiving module 504 is used to receive data and events from the zk server side and pass the events and data to the zk asynchronous queue management module through the pipes or queues of the zk asynchronous queue management module.

[0156] The following combination Figure 5 A brief description is given of the interaction process between the main logic module 501, the asynchronous task queue module 502, the zk request sending module 503, and the zk data and event receiving module 504.

[0157] For example, in S502, the main logic module 501 receives an external task request; then, in S504, the main logic module 501 sends an asynchronous task request to the asynchronous task queue module 502 according to the external task request; in S506, the asynchronous task queue module 502 sends an asynchronous ZooKeeper raw request to the ZooKeeper request sending module 503, where the ZooKeeper request sending module 503 is responsible for converting the asynchronous ZooKeeper raw request into a target request to be sent to the ZooKeeper server; then, in S508-1 or S508-2, the ZooKeeper data and event receiving module 504 performs an event callback or data callback after receiving the data returned by the server; then, in S510, the asynchronous task queue module 502 initiates an asynchronous task or watch callback to the main logic module 501; finally, in S512, the asynchronous task queue module 502 returns node response data to the outside.

[0158] The following describes the implementation of specific functions in the main logic module 501.

[0159] For global data storage and processing, a global tree-structured storage is implemented in the main logic module 501. This storage contains the children and values ​​of the nodes corresponding to the watched ZooKeeper paths. It is updated when a ZooKeeper event is triggered. The tree-structured data storage structure is not limited to multi-branch or multi-level maps; any data structure that can describe a tree is acceptable. The data fields that the nodes on the path need to store include:

[0160] 1. children: The child nodes of the current path;

[0161] 2. value: The value of the current path;

[0162] 3. expire: Whether unwatch has been executed on the current path;

[0163] The global tree-structured data storage object is mainly used for the following functions:

[0164] Function 1: When there is a zk event callback, compare it with the latest data on zk and generate incremental data;

[0165] Function 2: When a new request needs to fetch data from ZooKeeper, first check if it exists in the local storage. If it exists, retrieve the data directly and return it; otherwise, initiate an asynchronous request to ZooKeeper.

[0166] Feature 3: When an unwatch is executed on a ZooKeeper path, the expire field of the corresponding path in the local global data is first marked as true. When this path is watched again, the expire field of the corresponding path's data in the global tree storage is first checked to see if it is true. If it is, expire is directly marked as false, and the data is returned, thereby reducing ZooKeeper interactions.

[0167] For receiving external requests and returning synchronously, the main logic module 501 provides two interfaces: one is an interface for requesting and registering a watch, and the other is an interface for unwatching.

[0168] The `unwatch` interface is used to execute the unwatch logic for the specified path. It's important to note that `unwatch` works by performing cascading unwatches on child nodes of the passed path. That is, if the passed path is " / A / B", all child nodes of this path will be retrieved from the global tree-structured request and unwatched accordingly. If " / A / B" is the root path of a tree-structured request, then after performing the unwatch, this tree-structured request must be removed from the global K request list.

[0169] In addition, the interface for pulling and registering watches is used to receive a ZooKeeper data pull request with a tree-like structure. Upon receiving a request, each request is assigned a unique `reqId` and then saved to global memory. The data pull request with the tree-like structure includes the following parameters:

[0170] 1. rootPath: Used to identify the initial node of the current request;

[0171] 2. watchTypes: Describes the operations (watchTypes) that each ZooKeeper node needs to perform. The operation types (watchTypes) include:

[0172] (1) Retrieve and set the children change event callback;

[0173] (2) Retrieve and set the value change (node ​​data change) event callback;

[0174] (3) Retrieve and set the callbacks for the children change and value change events;

[0175] (4) Only fetch the child nodes of the current node;

[0176] (5) Only fetch data from the current node;

[0177] (6) Retrieve the child nodes and data of the current node.

[0178] In addition, the main logic module 501 includes the following interfaces for implementing related data acquisition functions. It should be noted that the following interfaces are used for internal client function implementation and are transparent to the user.

[0179] `callbackFunc` (callback function): The watch callback set in the current request. This method will be called when an event changes. Unlike existing methods that use a separate watch callback for each path, this invention uses a unique `callbackFunc` specified in the request for all callbacks. Within `callbackFunc`, the ZooKeeper path callback layer is identified by the passed path.

[0180] `watchTypeGetFunc(WatchTypeGetFunc)`: This method retrieves the `watchType` of a node on a ZooKeeper path, used to support data filtering. For example, if the current path contains data A, B, C, and D, this method can return an empty `watchType` when the node is D, indicating that no action needs to be taken on this node. When this method is empty, the `watchType` at the ZooKeeper level specified in `watchTypes` is used uniformly. That is, this method is preferred for obtaining the `watchType`; otherwise, the `watchType` at the specified level in the initially passed `watchTypes` is used.

[0181] To parse requests and construct asynchronous tasks, you can construct asynchronous request tasks based on the received data retrieval requests and send the tasks to the asynchronous task queue module.

[0182] In this embodiment, if the target node data is not obtained from the locally stored set of reference nodes, a corresponding data operation request can be added to the request queue based on the operation type of the data acquisition operation. For example, such as Figure 3As shown, when the data retrieval operation for node subsets C1, C2, and C3 is "fetch and set the callbacks for the children change and value change events", the following data operation request can be added to the request queue:

[0183] 1. Retrieve changes to the child nodes of C1, C2, and C3;

[0184] 2. Retrieve changes in node data for C1, C2, and C3;

[0185] 3. Set the callback for the children change event of C1, C2, and C3;

[0186] 4. Set the callback for the value change event of C1, C2, and C3.

[0187] Therefore, during the process of sending a request to the server, a type of data acquisition operation targeting the same layer of nodes is broken down into more granular operation requests.

[0188] For asynchronous data callback processing, specifically, we can first obtain the node's `watchType`. If `watchType` only indicates pure data retrieval without any watch registration, the data is saved to a temporary memory object bound to the current `req`. If `watchType` includes both data retrieval and watch registration, the data is saved to a global tree-like data structure, and a new asynchronous request is constructed and added to the asynchronous queue module. If the `watchType` of this node cannot be obtained, it is assumed that the current data is the last level of data in the current request, and there is no need to continue traversing downwards.

[0189] The asynchronous data callback processing flow is as follows: Figure 6 As shown:

[0190] First, based on the returned current node data, execute judgment S600 to determine if it is a no node (i.e., whether there is no data node corresponding to the current node data locally). If the judgment is yes (i.e., there is no data node corresponding to the current node data locally), execute step S602 to obtain the watch type (i.e., whether a monitoring operation needs to be performed). Next, execute judgment S604 to determine if a watch is included. If the monitoring type does not include a watch, execute S606 to obtain the watch type and update the returned data. If the monitoring type includes a watch, execute judgment S608 to determine if the current node is the root path. If the current node is the root node, execute S610 to set the exists watcher (node ​​creation monitoring, i.e., if a child node related to this node is created on the server, a callback is triggered). Next, execute S612 to update the returned data and local data to empty. If the current node is not the root node, directly execute S612 to update the returned data and local data to empty.

[0191] If the condition is negative (i.e., a data node corresponding to the current node's data exists locally), execute check S614 to determine if it is a callback trigger (i.e., whether it is a data callback triggered by a monitoring type event). If it is a callback trigger, first execute check S614-1 to determine if it is get_children. If it is get_children, execute the following steps:

[0192] The process involves: generating more / less data; updating local data; pushing incremental data and callback methods to the incremental queue; obtaining the watch type of child nodes; determining whether a node is watch-enabled; if the node corresponding to the current node's data is watch-enabled, checking if it is "More" (whether it's newly added data); if not "More", executing "Unwatch" (i.e., not monitoring); if it is "More", querying local data and checking if the local data exists; if the local data exists, checking if the node's expire field is true; if true, setting the node's expire field to false; if expire is false, repeating step S614. If the local data does not exist, initiating an asynchronous request task; and initiating an asynchronous getw / get_childrenw request, i.e., initiating a get_value watch or get_children watch request, to begin monitoring changes in the node's data or its child nodes.

[0193] If it is determined that it is not `get_children`, then execute check S614-2 again to determine if it is `get_value`; if it is `get_value`, then execute the following steps:

[0194] Update local data; push value and callback method to incremental queue; construct asynchronous request task; initiate asynchronous getw request, i.e. initiate get_value watch, to start monitoring data changes of this node;

[0195] If it is determined that it is not get_value, execute judgment S614-3 to determine whether it is the exist method; if it is, get the watch type of the child node; construct an asynchronous request task; initiate an asynchronous getw / get_childrenw request, that is, initiate a get_value watch or get_children watch request to start monitoring the data changes of the node or the changes of the child nodes.

[0196] If it is determined that the callback was not triggered, step S614-4 updates the returned data of get_children; then, a judgment is made to determine whether the traversal has ended; if the traversal has not ended, the watch type of the child node is obtained; the local data is queried; and it is determined whether the local data exists. If the local data does not exist, an asynchronous request task is initiated; and an asynchronous getw / get_childrenw request is initiated, that is, a get_value watch or get_children watch request is initiated to start monitoring the data changes or child node changes of the node.

[0197] If local data exists, retrieve the Expire field of the node. If Expire is true, determine whether the node's monitoring status includes watch. If the monitoring status includes watch, set Expire to false and proceed to step S614-4.

[0198] It should be noted that, Figure 6 In ZooKeeper, "more" and "less" refer to the difference between the latest child node in a ZooKeeper path and the last child node stored locally. For example, if the child nodes of the path " / A" currently stored locally are [b1, b2, b3], and a children change event is triggered in ZooKeeper, the latest child node obtained is [b2, b3, b4]. Then "more" would be [b4], and "less" would be [b1].

[0199] For asynchronous data callback processing, specifically, after receiving a ZooKeeper event notification through the asynchronous task queue module, it first checks if the `reqId` of the path containing the event is in the global `reqId` set. If not, it means that all paths of the current `req` have been unwatched and are ignored. If the `reqId` exists, it checks if this path is in the `expire` event set; if so, the `expire` data is deleted. Otherwise, based on the event type, a ZooKeeper request is constructed and added to the asynchronous task queue. For example, if it's a `children change` event, an asynchronous request task for a `children get` request is constructed; if it's a `value change` event, an asynchronous request task for a `value get` request is constructed. Then, the task is sent to the asynchronous request queue. The specific process is as follows: Figure 7 As shown:

[0200] S702, a callback event is received; then, judgment S704 is executed to check if the request exists; if the request does not exist, S704-1 is executed and the process returns; if the request exists, judgment step S706 is executed to check if the expire field is true; if the expire field is true, S706-1 is executed to delete the current path data from the global data; if the expire field is false, judgment S708 is executed to check if it is a callback for children change; if it is a callback for children change, then S710 is executed, children change adds asynchronous fetching of children and sets a watch request;

[0201] If it is not a children change callback, then execute check S708-1 to see if it is a value change callback; if it is a value change callback, then execute S712 to add asynchronous value fetching and set a watch request.

[0202] If it is not a value change callback, then execute check S708-2 to see if it is a create callback; if it is a create callback, execute S714 to get the watchType of the path; add asynchronous fetch and set watch request;

[0203] If it is not a `create` callback, then execute check S708-3 to determine if it is a `delete` callback; if it is a `delete` callback, determine if `exist watch` needs to be set; if it needs to be set, execute S716 to add asynchronous settings; if not, return the deletion result.

[0204] If it is not a delete callback, execute S708-4 for session processing.

[0205] The above-described implementation of this application provides a tree-structured method for requesting fully asynchronous ZooKeeper (ZK) data retrieval. In terms of implementation, developers are shielded from the transformation logic of ZK events. Developers only need to describe how to obtain ZK path data and set the watch types to obtain the correct full and incremental data from ZK. This eliminates the need to be aware of and implement the event transformation processing and watch setting logic required when ZK events change. Furthermore, because it is internally based on fully asynchronous ZK data retrieval and watch setting, it offers a significant performance improvement compared to synchronous ZK access.

[0206] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that the present invention is not limited to the described order of actions, because according to the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to the present invention.

[0207] According to another aspect of the present invention, a data acquisition apparatus for implementing the above-described data acquisition method is also provided. For example... Figure 8 As shown, the device includes:

[0208] The receiving unit 802 is used to receive a data acquisition request, wherein the data acquisition request is used to acquire target node data corresponding to the target node set, and the target node set is the set of nodes stored in the target distributed server;

[0209] The determining unit 804 is used to determine the operation type of the data acquisition operation to be performed on at least one subset of nodes in the target node set, based on the request description information carried in the data acquisition request, when no target node data is obtained from the locally stored reference node set. The reference node set is a set of nodes constructed based on the data set pre-returned by the target distributed server.

[0210] The asynchronous processing unit 806 is used to add a data operation request corresponding to at least one subset of nodes to the request queue according to the operation type of the data acquisition operation, wherein the request queue is used to asynchronously send the data operation request to the target distributed server.

[0211] The sending unit 808 is used to send the target node data returned by the target distributed server according to the data operation request.

[0212] Optionally, the determining unit 804 includes:

[0213] The first acquisition module is used to acquire node path information in the request description information, wherein the node path information is used to indicate the node path of the target node tree, and the target node set is a set of nodes composed of data nodes in the target node tree;

[0214] The second acquisition module is used to acquire at least one operation identifier in the request description information, wherein the operation identifier is used to indicate the operation type of the data acquisition operation, and at least one node subset is a set of nodes composed of data nodes in at least one layer of nodes;

[0215] The determination module is used to determine the operation type of the data acquisition operation corresponding to at least one layer of nodes based on at least one operation identifier.

[0216] Optionally, the asynchronous processing unit 806 includes:

[0217] The first adding module is used to add an asynchronous pull operation request to the request queue when the operation type of the data acquisition operation indicates that the data acquisition operation includes a node data pull sub-operation. The node data pull sub-operation is used to obtain node-related data corresponding to at least one node subset. The node-related data includes node data stored in the data nodes in the node subset and / or the reference node subset corresponding to each data node in the node subset.

[0218] The second adding module is used to add an asynchronous data monitoring operation request to the request queue when the operation type of the data acquisition operation indicates that the data acquisition operation includes a node data monitoring sub-operation. The node data monitoring sub-operation is used to obtain the changes in the node-related data corresponding to at least one subset of nodes.

[0219] Optionally, the above-mentioned determining module is also used for:

[0220] When the operation identifier is the first identifier, it is determined that the data acquisition operation is used to acquire the set of nodes consisting of the child nodes of each node in at least one layer of nodes, and to monitor the change status of the child nodes corresponding to each node in at least one layer of nodes.

[0221] When the operation identifier is the second identifier, it is determined that the data acquisition operation is used to acquire the node data stored in each node in at least one layer of nodes, and to monitor the data changes of the node data stored in each node in at least one layer of nodes;

[0222] When the operation identifier is the third identifier, it is determined that the data acquisition operation is used to acquire the set of nodes composed of the child nodes of each node in at least one layer of nodes, monitor the change status of the corresponding child nodes of each node in at least one layer of nodes, acquire the node data stored in each node in at least one layer of nodes, and monitor the data changes of the node data stored in each node in at least one layer of nodes.

[0223] When the operation identifier is the fourth identifier, it is determined that the data acquisition operation is used to acquire the set of nodes consisting of the child nodes of each node in at least one level of nodes;

[0224] When the operation identifier is the fifth identifier, it is determined that the data acquisition operation is used to acquire the node data stored in each node in at least one layer of nodes;

[0225] When the operation identifier is the sixth identifier, it is determined that the data acquisition operation is used to acquire the set of nodes consisting of the child nodes of each node in at least one layer of nodes, and to acquire the node data stored in each node in at least one layer of nodes.

[0226] Optionally, the above-mentioned data acquisition device includes:

[0227] The sending unit 808 is also used to send target node data when target node data is obtained from a locally stored set of reference nodes;

[0228] The determining unit 804 is further configured to determine the operation type of the data acquisition operation to be performed on at least one subset of nodes in the target node set based on the request description information carried in the data acquisition request; when the operation type of the data acquisition operation indicates that the data acquisition operation includes a node data monitoring sub-operation, an asynchronous data monitoring operation request is added to the request queue, wherein the node data monitoring sub-operation is used to obtain the changes in the node-related data corresponding to at least one subset of nodes, and the node-related data includes the node data stored in the data nodes in the subset of nodes, and / or the reference node subsets corresponding to each data node in the subset of nodes.

[0229] Optionally, the asynchronous processing unit 806 described above is further configured to:

[0230] S1, if the request queue includes data operation requests that have not yet been sent, retrieve a data operation request from the request queue as the current operation request, and asynchronously send the current operation request to the target distributed server;

[0231] S2, add the current response request corresponding to the current operation request to the return queue. The return queue stores response requests corresponding to multiple responses for which response data has not yet been obtained. The current response request is used to obtain the response data returned by the target distributed server in response to the current operation request.

[0232] S3, upon receiving response data from the target distributed server, removes the current response request from the return queue and determines the target node data based on the response data.

[0233] Optionally, the asynchronous processing unit 806 described above is further configured to:

[0234] S1, compare the node data included in the response data with the node data of the corresponding node subset in the reference node set to determine the node change data;

[0235] S2, when the current operation request is an asynchronous data monitoring operation request, determines the node change data as the target node data.

[0236] Optionally, the asynchronous processing unit 806 described above is further configured to:

[0237] S1, the operation type for retrieving data from the subset of nodes corresponding to the response data;

[0238] S2, if the operation type of the data acquisition operation indicates that the data acquisition operation includes a node data monitoring sub-operation, add an asynchronous data monitoring operation request to the request queue, wherein the node data monitoring sub-operation is used to obtain the changes in the node-related data corresponding to at least one subset of nodes.

[0239] Optionally, the asynchronous processing unit 806 described above is further configured to:

[0240] S1, the operation type for retrieving data from the subset of nodes corresponding to the response data;

[0241] S2, where the operation type of the data acquisition operation indicates that the data acquisition operation includes a node data monitoring sub-operation, and the response data includes node-related data, node-related data is added to the locally stored set of reference nodes. The node data monitoring sub-operation is used to obtain the changes in the node-related data corresponding to at least one subset of nodes. The node-related data includes the node data stored in the nodes of the node subset, and / or the reference node subset corresponding to each node in the node subset.

[0242] Optionally, the above-mentioned data acquisition device is further used for:

[0243] S1, Receive the first data acquisition request;

[0244] S2, if the request description information in the first data acquisition request indicates that the data acquisition operation performed on the first node subset includes the node data monitoring sub-operation, then based on the first node data obtained from the target distributed server, a first node tree corresponding to the first node subset is constructed locally. The first node tree is used to store the first node data. Each data node in the first node tree stores a child node field, a data field, and an invalidation field. The child node field is used to indicate the child node corresponding to the current data node, the data field is used to indicate the node data stored in the current data node, and the invalidation field is used to indicate the monitoring status of the current data node.

[0245] Optionally, the above-mentioned data acquisition device is further used for:

[0246] S1, Receive the second data acquisition request;

[0247] S2, if the request description information in the second data acquisition request indicates that the data operation performed on the first node subset includes canceling the node data monitoring sub-operation, then the failure field of each data node in the first node subset is marked as failed.

[0248] Optionally, in this embodiment, the implementation of each of the above-mentioned unit modules can be referred to the above-mentioned method embodiments, which will not be repeated here.

[0249] According to another aspect of the present invention, an electronic device for implementing the above-described data acquisition method is also provided. This electronic device may be... Figure 9 The terminal device or server shown. This embodiment uses this electronic device as an example for illustration. Figure 9 As shown, the electronic device includes a memory 902 and a processor 904. The memory 902 stores a computer program, and the processor 904 is configured to execute the steps of any of the above method embodiments through the computer program.

[0250] Optionally, in this embodiment, the aforementioned electronic device may be located in at least one of a plurality of network devices in a computer network.

[0251] Optionally, in this embodiment, the processor can be configured to perform the following steps via a computer program:

[0252] S1, Receive data acquisition request, wherein the data acquisition request is used to acquire target node data corresponding to the target node set, and the target node set is the set of nodes stored in the target distributed server;

[0253] S2, if the target node data is not obtained from the locally stored reference node set, determine the operation type of the data acquisition operation to be performed on at least one subset of nodes in the target node set based on the request description information carried in the data acquisition request. The reference node set is a set of nodes constructed based on the data set pre-returned by the target distributed server.

[0254] S3, based on the operation type of the data acquisition operation, add a data operation request corresponding to at least one subset of nodes to the request queue, wherein the request queue is used to asynchronously send data operation requests to the target distributed server;

[0255] S4, send the target node data returned by the target distributed server based on the data operation request.

[0256] Alternatively, as those skilled in the art will understand, Figure 9 The structure shown is for illustrative purposes only. Electronic devices can also be smartphones (such as Android phones, iOS phones, etc.), tablets, PDAs, mobile internet devices (MIDs), PADs, and other terminal devices. Figure 9 This does not limit the structure of the aforementioned electronic devices or electronic equipment. For example, electronic devices or electronic equipment may also include components that are more... Figure 9 The more or fewer components shown (such as network interfaces, etc.), or having the same Figure 9 The different configurations shown.

[0257] The memory 902 can be used to store software programs and modules, such as the program instructions / modules corresponding to the data acquisition method and apparatus in this embodiment of the invention. The processor 904 executes various functional applications and data processing by running the software programs and modules stored in the memory 902, thereby realizing the aforementioned data acquisition method. The memory 902 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 902 may further include memory remotely located relative to the processor 904, and these remote memories can be connected to the terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. Specifically, the memory 902 may be used, but is not limited to, to store various elements in the scene image, data acquisition information, and other information. As an example, such as... Figure 9As shown, the memory 902 may include, but is not limited to, the receiving unit 802, the determining unit 804, the asynchronous processing unit 806, and the sending unit 808 from the data acquisition device described above. Furthermore, it may include, but is not limited to, other module units from the data acquisition device described above, which will not be elaborated upon in this example.

[0258] Optionally, the transmission device 906 described above is used to receive or send data via a network. Specific examples of the network described above may include wired networks and wireless networks. In one example, the transmission device 906 includes a Network Interface Controller (NIC), which can be connected to other network devices and routers via a network cable to communicate with the Internet or a local area network. In another example, the transmission device 906 is a Radio Frequency (RF) module, used for wireless communication with the Internet.

[0259] In addition, the aforementioned electronic device also includes: a display 908 for displaying virtual scenes in the interface; and a connection bus 910 for connecting various module components in the aforementioned electronic device.

[0260] In other embodiments, the aforementioned terminal device or server can be a node in a distributed system, wherein the distributed system can be a blockchain system, which is a distributed system formed by connecting multiple nodes through network communication. The nodes can form a peer-to-peer (P2P) network, and any form of computing device, such as a server, terminal, or other electronic device, can become a node in the blockchain system by joining this peer-to-peer network.

[0261] According to one aspect of this application, a computer program product is provided, comprising a computer program / instructions containing program code for performing the methods shown in the flowchart. In such embodiments, the computer program can be downloaded and installed from a network via a communication component, and / or installed from a removable medium. When the computer program is executed by a central processing unit, it performs various functions provided in embodiments of this application.

[0262] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0263] According to one aspect of this application, a computer-readable storage medium is provided, wherein a processor of a computer device reads computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, causing the computer device to perform the above-described data acquisition method.

[0264] Optionally, in this embodiment, the computer-readable storage medium may be configured to store a computer program for performing the following steps:

[0265] S1, Receive data acquisition request, wherein the data acquisition request is used to acquire target node data corresponding to the target node set, and the target node set is the set of nodes stored in the target distributed server;

[0266] S2, if the target node data is not obtained from the locally stored reference node set, determine the operation type of the data acquisition operation to be performed on at least one subset of nodes in the target node set based on the request description information carried in the data acquisition request. The reference node set is a set of nodes constructed based on the data set pre-returned by the target distributed server.

[0267] S3, based on the operation type of the data acquisition operation, add a data operation request corresponding to at least one subset of nodes to the request queue, wherein the request queue is used to asynchronously send data operation requests to the target distributed server;

[0268] S4, send the target node data returned by the target distributed server based on the data operation request.

[0269] Optionally, in this embodiment, those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing the hardware related to the terminal device. The program can be stored in a computer-readable storage medium, which may include: flash drive, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.

[0270] If the integrated units in the above embodiments are implemented as software functional units and sold or used as independent products, they can be stored in the aforementioned computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause one or more computer devices (which may be personal computers, servers, or network devices, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention.

[0271] In the above embodiments of the present invention, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0272] In the several embodiments provided in this application, it should be understood that the disclosed client can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units described above is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, indirect coupling or communication connection between units or modules, and may be electrical or other forms.

[0273] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0274] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0275] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. A data acquisition method, characterized in that, include: Receive a data acquisition request, wherein the data acquisition request is used to acquire target node data corresponding to a target node set, and the target node set is a set of nodes stored in the target distributed server; If the target node data is not obtained from the locally stored reference node set, the operation type of the data acquisition operation to be performed on at least one subset of nodes in the target node set is determined according to the request description information carried in the data acquisition request, wherein the reference node set is a node set constructed based on the data set pre-returned by the target distributed server; According to the operation type of the data acquisition operation, a data operation request corresponding to the at least one subset of nodes is added to the request queue, wherein the request queue is used to asynchronously send the data operation request to the target distributed server; Send the target node data returned by the target distributed server based on the data operation request.

2. The method according to claim 1, characterized in that, The step of determining the operation type for data acquisition operations to be performed on at least one subset of nodes in the target node set based on the request description information carried in the data acquisition request includes: Obtain the node path information from the request description information, wherein the node path information is used to indicate the node path of the target node tree, and the target node set is a set of nodes composed of data nodes in the target node tree; Obtain at least one operation identifier from the request description information, wherein the operation identifier is used to indicate the operation type of the data acquisition operation, and the at least one node subset is a set of nodes composed of data nodes in at least one layer of nodes; The operation type of the data acquisition operation corresponding to the at least one layer node is determined based on the at least one operation identifier.

3. The method according to claim 2, characterized in that, The step of adding a data operation request corresponding to the at least one subset of nodes to the request queue according to the operation type of the data acquisition operation includes: When the operation type of the data acquisition operation indicates that the data acquisition operation includes a node data pull sub-operation, an asynchronous pull operation request is added to the request queue, wherein the node data pull sub-operation is used to acquire node-related data corresponding to at least one node subset, the node-related data including node data stored in the data nodes in the node subset, and / or the reference node subset corresponding to each data node in the node subset; If the operation type of the data acquisition operation indicates that the data acquisition operation includes a node data monitoring sub-operation, an asynchronous data monitoring operation request is added to the request queue, wherein the node data monitoring sub-operation is used to obtain the changes in the node-related data corresponding to at least one subset of nodes.

4. The method according to claim 2, characterized in that, The step of determining the operation type of the data acquisition operation corresponding to the at least one layer node based on the at least one operation identifier includes at least one of the following: When the operation identifier is the first identifier, it is determined that the data acquisition operation is used to acquire the set of nodes composed of the child nodes of each node in the at least one layer of nodes, and to monitor the change status of the child nodes corresponding to each node in the at least one layer of nodes; When the operation identifier is the second identifier, it is determined that the data acquisition operation is used to acquire the node data stored in each node of the at least one layer of nodes, and to monitor the data changes of the node data stored in each node of the at least one layer of nodes; When the operation identifier is the third identifier, it is determined that the data acquisition operation is used to acquire the node set composed of the child nodes of each node in the at least one layer of nodes, monitor the change status of the corresponding child nodes of each node in the at least one layer of nodes, acquire the node data stored in each node in the at least one layer of nodes, and monitor the data changes of the node data stored in each node in the at least one layer of nodes. When the operation identifier is the fourth identifier, it is determined that the data acquisition operation is used to acquire the set of nodes composed of the child nodes of each node in the at least one layer of nodes; When the operation identifier is the fifth identifier, it is determined that the data acquisition operation is used to acquire the node data stored in each node of the at least one layer of nodes; When the operation identifier is the sixth identifier, it is determined that the data acquisition operation is used to acquire the node set composed of the child nodes of each node in the at least one layer of nodes, and to acquire the node data stored in each node in the at least one layer of nodes.

5. The method according to claim 1, characterized in that, After receiving the data acquisition request, the method further includes: If the target node data is obtained from the locally stored set of reference nodes, the target node data is sent. Based on the request description information carried in the data acquisition request, determine the operation type of the data acquisition operation to be performed on at least one subset of nodes in the target node set; When the operation type of the data acquisition operation indicates that the data acquisition operation includes a node data monitoring sub-operation, an asynchronous data monitoring operation request is added to the request queue. The node data monitoring sub-operation is used to obtain the changes in node-related data corresponding to at least one node subset. The node-related data includes node data stored in the data nodes of the node subset and / or the reference node subset corresponding to each data node in the node subset.

6. The method according to claim 5, characterized in that, After adding the data operation request corresponding to the at least one subset of nodes to the request queue, the method further includes: If the request queue includes data operation requests that have not yet been sent, a data operation request is retrieved from the request queue as the current operation request, and the current operation request is sent asynchronously to the target distributed server; Add a current response request corresponding to the current operation request to the return queue. The return queue stores multiple response requests that have not yet received response data. The current response request is used to obtain the response data returned by the target distributed server in response to the current operation request. Upon receiving response data from the target distributed server, the current response request is removed from the return queue, and the target node data is determined based on the response data.

7. The method according to claim 6, characterized in that, Determining the target node data based on the response data includes: The node data included in the response data is compared with the node data of the corresponding node subset in the reference node set to determine the node change data; If the current operation request is the asynchronous data monitoring operation request, the node change data is determined as the target node data.

8. The method according to claim 6, characterized in that, The step of deleting the current response request from the return queue and using the response data as the target node data upon receiving response data from the target distributed server further includes: The operation type for obtaining the data acquisition operation of the node subset corresponding to the response data; If the operation type of the data acquisition operation indicates that the data acquisition operation includes a node data monitoring sub-operation, an asynchronous data monitoring operation request is added to the request queue, wherein the node data monitoring sub-operation is used to obtain the changes in the node-related data corresponding to at least one subset of nodes.

9. The method according to claim 6, characterized in that, The step of deleting the current response request from the return queue and using the response data as the target node data upon receiving response data from the target distributed server further includes: The operation type for obtaining the data acquisition operation of the node subset corresponding to the response data; When the operation type of the data acquisition operation indicates that the data acquisition operation includes a node data monitoring sub-operation, and the response data includes node association data, the node association data is added to the locally stored set of reference nodes. The node data monitoring sub-operation is used to obtain the changes in the node association data corresponding to at least one subset of nodes. The node association data includes the node data stored in the nodes in the subset of nodes, and / or the reference node subsets corresponding to each node in the subset of nodes.

10. The method according to any one of claims 1 to 9, characterized in that, Before receiving a data retrieval request, it also includes: Receive the first data retrieval request; If the request description information in the first data acquisition request indicates that the data acquisition operation performed on the first node subset includes a node data monitoring sub-operation, a first node tree corresponding to the first node subset is constructed locally based on the first node data acquired from the target distributed server. The first node tree is used to store the first node data. Each data node in the first node tree stores a child node field, a data field, and an invalidation field. The child node field is used to indicate the child node corresponding to the current data node, the data field is used to indicate the node data stored in the current data node, and the invalidation field is used to indicate the monitoring status of the current data node.

11. The method according to any one of claims 1 to 9, characterized in that, After creating a first node tree corresponding to the first node subset locally based on the first node data obtained from the target distributed server, the method further includes: Receive the second data acquisition request; If the request description information in the second data acquisition request indicates that the data operation performed on the first node subset includes canceling the node data monitoring sub-operation, then the failure field of each data node in the first node subset is marked as invalid.

12. A data acquisition device, characterized in that, include: A receiving unit is configured to receive a data acquisition request, wherein the data acquisition request is used to acquire target node data corresponding to a target node set, and the target node set is a set of nodes stored in a target distributed server; The determining unit is configured to, when the target node data is not obtained from the locally stored reference node set, determine the operation type of the data acquisition operation to be performed on at least one subset of nodes in the target node set based on the request description information carried in the data acquisition request, wherein the reference node set is a node set constructed based on the data set pre-returned by the target distributed server; An asynchronous processing unit is used to add a data operation request corresponding to the at least one subset of nodes to a request queue according to the operation type of the data acquisition operation, wherein the request queue is used to asynchronously send the data operation request to the target distributed server. The sending unit is used to send the target node data returned by the target distributed server according to the data operation request.

13. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein the program, when executed, performs the method described in any one of claims 1 to 11.

14. A computer program product comprising a computer program / instructions, characterized in that, When the computer program / instructions are executed by the processor, they implement the steps of the method according to any one of claims 1 to 11.

15. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to execute the method described in any one of claims 1 to 11 through the computer program.

Citation Information

Patent Citations

  • Data access request processing method, apparatus and apparatus, and storage medium

    CN109375872A

  • Efficient data access in clustered storage system

    US8554867B1