WO2014146240A1 - Data update method and server for distributed storage system - Google Patents

Data update method and server for distributed storage system Download PDF

Info

Publication number
WO2014146240A1
WO2014146240A1 PCT/CN2013/072840 CN2013072840W WO2014146240A1 WO 2014146240 A1 WO2014146240 A1 WO 2014146240A1 CN 2013072840 W CN2013072840 W CN 2013072840W WO 2014146240 A1 WO2014146240 A1 WO 2014146240A1
Authority
WO
WIPO (PCT)
Prior art keywords
node
value
key value
version number
key
Prior art date
Application number
PCT/CN2013/072840
Other languages
French (fr)
Chinese (zh)
Inventor
娄东风
周训淼
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to PCT/CN2013/072840 priority Critical patent/WO2014146240A1/en
Priority to CN201380000766.3A priority patent/CN103518364B/en
Publication of WO2014146240A1 publication Critical patent/WO2014146240A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor

Definitions

  • the present invention relates to the field of data processing, and in particular, to a method and a server for processing an index node. Background technique
  • the Key-Value storage system uses a key-value pair Key-Value as the organization of the data. According to a certain hash algorithm, these Key-Values are allocated to the storage system on a massive number of nodes. For the processing of node data in the distributed Key-Value storage system, the query can be performed, and operations such as adding, modifying, and deleting can be performed through the distributed simple database system SimpleDB based on the distributed Key-Value storage system.
  • node data in a distributed Key-Value storage system it is necessary to search for node data in a distributed Key-Value storage system through a distributed index, which is composed of a large number of Key-Values, usually In a tree structure, there is a root node, and the data corresponding to the nodes in the distributed index is stored in the distributed Key-Value system.
  • a distributed index which is composed of a large number of Key-Values, usually In a tree structure, there is a root node, and the data corresponding to the nodes in the distributed index is stored in the distributed Key-Value system.
  • a distributed shared lock needs to be acquired, and a shared lock is added to the target node, so that a write request to the target node is blocked during a read operation; when a write request is implemented, a distribution needs to be acquired.
  • the exclusive lock which adds an exclusive lock to the target node, so that the read request to the target node is blocked during the write operation. Therefore, using the distributed lock control concurrency method for read and write operations can prevent the node data from being read during the modification process, ensuring that the complete node data is read.
  • the invention provides a data update method for a distributed key-value pair Key-Value storage system and a corresponding server. By using the method of the invention, not only the dirty data can be avoided, but also the read and write concurrency is realized.
  • a first aspect of the present invention provides a method for adding an index node, including:
  • the storage layer in the distributed Key-Value storage system includes a first storage tree, and the first storage tree includes a first root node, and the method includes:
  • the first root node is stored in the first storage tree in a storage tier in the distributed Key-Value storage system.
  • the parent node new key value and the new key value of each of the superior nodes are unique key values in the first storage tree.
  • the method after the copying the first root node into a buffer layer of the distributed Key-Value storage system, the method also includes:
  • the new key value of the parent node is a key value obtained by replacing the version number in the original key value of the parent node with the new version number, and the new key value of each of the upper node And a key value obtained by replacing the version number in the original key value corresponding to each of the upper nodes with the new version number.
  • a second aspect of the present invention provides a data update method for a distributed key-value pair Key-Value storage system, where a storage layer in the distributed Key-Value storage system includes a first storage tree, and the first storage tree includes a first a node, the method includes:
  • the original key values of the two nodes are different
  • Determining a parent node of the second node copying the parent node to a buffer layer of the distributed Key-Value storage system, assigning a new key value to the parent node, and pairing the content of the parent node
  • the pointing of the second node having the original key value is modified to be the pointing of the second node having the new key value, wherein the new key value of the parent node is different from the original key value of the parent node;
  • the first root node is stored in the first storage tree in a storage tier in the distributed Key-Value storage system.
  • a new key value of the second node, a new key value of the parent node, and a new key of each of the upper node are all unique key values in the first storage tree.
  • the method also includes:
  • the new key value of the second node is a key value obtained by replacing the version number in the original key value of the second node with the new version number
  • the new key value of the parent node is Replacing the version number in the original key value of the parent node with the key value obtained after the new version number
  • the new key value of each of the upper node is the original key corresponding to each of the upper nodes
  • the version number in the value is replaced with the key value obtained after the new version number.
  • a third aspect of the present invention provides a data update method for a distributed key-value pair Key-Value storage system, where a storage layer in the distributed Key-Value storage system includes a first storage tree, and the first storage tree includes a first a node, the method includes:
  • the node assigns a new key value, and respectively adds a pointer to a next-level node that assigns a new key value in the content of each of the upper-level nodes, wherein the new key value of each of the upper-level nodes and the original key value corresponding thereto Different
  • the first level node is a node that is closest to the root node on the branch of the parent node to the first root node;
  • the first root node is stored in the first storage tree in a storage tier in the distributed Key-Value storage system.
  • the new key value of the parent node of the third node and the new key value of each of the upper node are The unique key value in the storage tree.
  • the method After the first root node is copied into the buffer layer of the distributed Key-Value storage system, the method also includes:
  • the new key value of the parent node is obtained by replacing the version number in the original key value of the parent node with the new version number
  • the key value of each of the upper nodes is a key value obtained by replacing the version number in the original key value corresponding to each of the upper nodes with the new version number.
  • a fourth aspect of the present invention provides a method for reading an index node, including:
  • the method for reading an index node further includes: if the version number corresponding to the shared lock does not match the version number of the re-read root node, The version number of the root node after re-reading is taken as the version number of the currently read root node, and the step of obtaining the shared lock corresponding to the version number of the currently read root node is returned.
  • a fifth aspect of the present invention provides a server, including:
  • An obtaining unit configured to acquire a first data update request, where the first data update request includes: adding a key value of the first node in a first storage tree in a storage layer in the distributed Key-Value storage system Content, the first storage tree includes a first root node;
  • a processing unit configured to copy the first root node into a buffer layer of the distributed Key-Value storage system; further configured to determine a parent node of the first node, and copy the parent node to the distribution In the buffer layer of the Key-Value storage system, assigning a new key value to the parent node, adding a pointer to the first node in the content of the parent node, where the new key value of the parent node Different from the original key value of the parent node; and used to sequentially copy the parent node to other upper nodes on the branch of the first root node to the buffer layer of the distributed Key-Value storage system, Until the root node is reached, and a new key value is assigned to each of the upper nodes, and a pointer to a next-level node that assigns a new key value is respectively added in the content of each of the upper-level nodes, wherein each of the The new key value of the upper node is different from the original key value thereof; and is further configured to add a pointer
  • a storage unit configured to store the first node, a parent node of the first node, and a parent node of the parent node into a storage layer in the distributed Key-Value storage system; After the first node, the parent node of the first node, and the upper node of the parent node are stored in the storage layer, storing the first root node into the first storage in the storage layer In the tree.
  • the parent node new key value and the new key value of each of the upper node are all in the first storage tree.
  • the unique key value is the unique key value.
  • the processing unit is further configured to: copy the first root node to the distribution After the key-value storage system is in the buffer layer, a new version number is assigned to the copied first root node, and the new key value of the parent node is the version number in the original key value of the parent node. Replacing the key value obtained after the new version number, the new key value of each upper node is replacing the version number in the original key value corresponding to each of the upper nodes with the new version number The key value obtained afterwards.
  • a sixth aspect of the present invention provides a server, including: An obtaining unit, configured to obtain a second data update request, where the second data update request includes new content of the second node that needs to be updated;
  • a processing unit configured to copy a first root node in a first storage tree in a storage layer of the distributed Key-Value storage system into a buffer layer of the distributed Key-Value storage system;
  • the original key value of the second node and the original content are added to the buffer layer of the distributed Key-Value storage system, the new node is assigned a new key value, and the original content of the second node is updated to a new content of the second node, where the new key value of the second node is different from the original key value of the second node; and is further used to determine a parent node of the second node, and copy the parent node Going to the buffer layer of the distributed Key-Value storage system, assigning a new key value to the parent node, and modifying a pointer of the second node having the original key value in the content of the parent node to have a new key Pointing to a second node of the value, wherein the new key value of the parent node is different from the original key value of the
  • Pointing to the level node, wherein the new key value of each of the upper nodes is different from the original key value thereof; and is further configured to add, to the content of the first root node, the first level node of the upper node Pointing, wherein the first level node is a node from the parent node to a branch of the first root node that is closest to the root node;
  • a storage unit configured to store the second node, a parent node of the second node, and a parent node of the parent node into a storage layer in the distributed Key-Value storage system; After the second node, the parent node of the second node, and the upper node of the parent node are stored in the storage layer, storing the first root node to the first one in the storage layer In the storage tree.
  • the new key value of the second node, the new key value of the parent node, and the new key of each of the upper nodes are all unique key values in the first storage tree.
  • the processing unit is further configured to: buffer the first root node to the distributed Key-Value storage system After the layer, assigning a new version number to the copied first root node; then, the new key value of the second node is replacing the version number in the original key value of the second node with the new one After the version number
  • the key value to which the new key value of the parent node is obtained by replacing the version number in the original key value of the parent node with the new version number, and the new key of each upper node
  • the key value is a key value obtained by replacing the version number in the original key value corresponding to each of the upper nodes with the new version number.
  • a seventh aspect of the present invention provides a server, including:
  • An obtaining unit configured to obtain a third data update request, where the third data update request includes a third node that needs to be deleted;
  • a processing unit configured to copy a first root node in a first storage tree in a storage layer in the distributed Key-Value storage system into a buffer layer of the distributed Key-Value storage system; a parent node of the third node, copying the parent node to a buffer layer of the distributed Key-Value storage system, assigning a new key value to the parent node, and deleting the content of the parent node to the a pointing of the third node, where the new key value of the parent node is different from the original key value of the parent node; and is further configured to sequentially copy the parent node to other superior nodes on the branch of the first root node Going to the buffer layer of the distributed Key-Value storage system until reaching the root node, and assigning a new key value to each of the upper nodes, and adding a new pair to each of the contents of each of the upper nodes Pointing to a next-level node of the key value, wherein the new key value of each of the upper-level nodes is
  • a storage unit configured to store a parent node of the third node and a superior node of the parent node into a storage layer in the distributed Key-Value storage system; After the parent node and the upper node of the parent node are stored in the storage layer in the distributed Key-Value storage system, the first root node is stored in a storage layer in the distributed Key-Value storage system In the first storage tree.
  • the new key value of the parent node of the third node and the new key value of each of the upper node are The unique key value in the storage tree.
  • the processing unit is further configured to: copy the first root node to the distributed Key-Value storage system After the layer is layered, a new version number is assigned to the first root node of the copy;
  • the new key value is a key value obtained by replacing the version number in the original key value of the parent node with the new version number, and the new key value of each of the upper nodes is the each superior
  • the version number in the original key value corresponding to the node is replaced with the key value obtained after the new version number.
  • An eighth aspect of the present invention provides a server, including:
  • a first reading unit configured to read a root node in the index
  • a obtaining unit configured to acquire a shared lock corresponding to a version number of the currently read root node; a second reading unit, configured to re-read the root node after acquiring the shared lock; Verifying that the version number corresponding to the shared lock is the same as the version number of the root node after re-reading. If the version number corresponding to the shared lock is the same as the version number of the root node after re-reading, The root node after reading adds the shared lock;
  • a read operation unit configured to perform an operation of reading the target node under the root node from the storage layer of the Key-Value system from the key value after the shared lock is added to the re-read root node.
  • the verification unit is further configured to: if the version number corresponding to the shared lock does not match the version number of the root node after re-reading, The version number of the root node is the version number of the currently read root node, so that the obtaining unit acquires the shared lock corresponding to the version number of the currently read root node.
  • a ninth aspect of the present invention provides a server, including a processor, a memory, a bus, and a communication interface; the memory is configured to store a computer execution instruction, and the processor is connected to the memory through the bus, when the server In operation, the processor executes the computer-executed instructions stored in the memory, and communicates with the device of the server unit through the communication interface, so that the server performs the first aspect, the second aspect,
  • the third aspect and the data update method of the distributed key-value pair Key-Value storage system described in various possible manners.
  • a tenth aspect of the present invention provides a computer readable medium, comprising: computer executable instructions for executing, by a processor of a computer, the first aspect, the second aspect, the third aspect, and A data update method for a distributed key-value pair Key-Value storage system as described in various possible ways.
  • the Key-Value system is before the first root node in the buffer layer is stored in the storage layer. There is no root node in the storage layer that can be used to find the first node, and cannot be read. The first node in the Key-Value system. After the first root node in the buffer layer is stored in the storage layer, the first node is also already stored in the storage layer, and the data of the first node has been determined, thereby avoiding Dirty data is read in the first node.
  • the root node in the buffer layer of the Key-Value storage system is stored in the storage layer only according to the storage.
  • the root node in the layer finds the second node that is not updated, and cannot read the data of the updated second node in the storage layer.
  • the root node in the buffer layer is stored in the storage layer, since the updated second node has also been stored to the storage layer, and the updated second node can be found according to the newly stored root node. So as to avoid reading dirty data from the second node.
  • a read operation can be performed, and the read operation can be read.
  • the unupdated second node stored in the storage layer does not read dirty data.
  • the first node finds the third node in the storage layer, can read it, and can read the data of the complete third node, thereby achieving concurrent deletion of the node and read operation, and avoiding reading at the same time. Get dirty data. After the first root node of the buffer layer is stored to the storage layer, the third node cannot be found according to the first root node newly stored in the storage layer.
  • the root node when the version number corresponding to the currently read shared lock is the same as the version number of the re-read root node, the root node is unchanged, and the root may be The target node under the node adds the shared lock and then performs a read operation.
  • the version number corresponding to the obtained shared lock is inconsistent with the version number of the root node after re-reading, the version number of the root node is changed after the shared lock is obtained, and the acquired shared lock is invalid, and needs to be re-acquired.
  • a shared lock corresponding to the version number of the re-read root node Therefore, the method of reading the index node provided by the present invention can ensure that the shared lock passed by the verification can successfully lock the target node.
  • FIG. 1 is a schematic diagram of a system architecture of mass storage
  • Embodiment 2 is a number of distributed key-value pair Key-Value storage systems according to Embodiment 1 of the present invention. According to the flow chart of the update method;
  • FIG. 3 is a schematic diagram of a node distribution according to Embodiment 1 of the present invention.
  • FIG. 4 is a schematic flowchart of a data update method for a distributed key-value pair Key-Value storage system according to Embodiment 2 of the present invention
  • FIG. 5 is a schematic diagram of a node distribution according to Embodiment 2 of the present invention.
  • FIG. 6 is a schematic flowchart of a data update method of a distributed key-value pair Key-Value storage system according to Embodiment 3 of the present invention.
  • FIG. 7 is a schematic diagram of a node distribution according to Embodiment 3 of the present invention.
  • FIG. 8 is a schematic flowchart of a method for reading an index node according to Embodiment 4 of the present invention
  • FIG. 9 is a block diagram of a server structure according to Embodiment 5 of the present invention.
  • FIG. 10 is a structural block diagram of a server according to Embodiment 6 of the present invention.
  • FIG. 11 is a block diagram showing a structure of a server according to Embodiment 7 of the present invention.
  • FIG. 12 is a block diagram showing a structure of a server according to Embodiment 8 of the present invention.
  • FIG. 13 is a schematic diagram of a bus connection structure of a server provided by the present invention.
  • FIG. 14 is a schematic diagram of a bus connection structure of still another server provided by the present invention. detailed description
  • Embodiments of the present invention provide a data update method for a distributed key-value pair Key-Value storage system.
  • the following describes the scenarios in which the embodiments of the present invention can be applied.
  • Figure 1. 1 shows a system architecture in which an embodiment of the present invention can be implemented.
  • the system architecture includes a client 101 of a simple database SDB, a network layer Web layer 102, a buffer layer Cache layer 103, and a storage layer Store layer 104, wherein the storage layer 104 For the Key-Value storage system, the buffer layer 103 mainly provides a license service LC (License Client) Server.
  • LC License Client
  • the operation of the distributed index (such as adding an index node, modifying the index node, etc.) is performed at the buffer layer, and the node data to be stored is persistently stored in the storage layer.
  • the distributed index such as adding an index node, modifying the index node, etc.
  • Embodiment 1 provides a data update method for a distributed key-value pair Key-Value storage system.
  • an index node is added as an example, and the storage in the distributed Key-Value storage system is used.
  • the layer includes a first storage tree, the first storage tree includes a first root node, and the method includes: 201: Acquire a first data update request, where the first data update request includes a need to be in the first storage Add the key value and content of the first node to the tree. 202. Copy the first root node into a buffer layer of the distributed Key-Value storage system.
  • 203 Determine a parent node of the first node in the first storage tree, copy the parent node to a buffer layer of the distributed Key-Value storage system, and allocate a new key value to the parent node. Adding a pointer to the first node in the content of the parent node. The new key value of the parent node is different from the original key value of the parent node.
  • the buffer layer modifying the key value and content of the parent node in the first storage tree, so that the modified parent node's new key value is different from the original key value, and the content thereof is increased.
  • the orientation of the first node is increased.
  • Step 204 Copy the parent node to other upper nodes on the branch of the first root node to the buffer layer of the distributed Key-Value storage system, until the root node is reached, and for each upper level The node assigns a new key value, and respectively adds a pointer to the next level node that assigns the new key value in the content of each of the superior nodes.
  • the new key value of each of the upper nodes is different from the corresponding original key value.
  • adding a point to the next-level node that assigns a new key value in the content of each of the upper-level nodes, respectively includes adding a new pair to the content of the upper-level node that is closest to the parent node. The pointer to the parent of the key value.
  • the first level node is a node that is closest to the root node on the branch of the parent node to the first root node.
  • the direction of the first-level node of the upper-level node before the allocation of the new key value in the content of the first root node may be modified to the first-level node of the upper-level node after the new key value is allocated. Pointing.
  • the content of the first root node, the parent node, and the upper node in the storage layer does not point to the first node, so If a read operation occurs in the storage process of the first node, the first node in the storage layer cannot find the first node, and the dirty data of the first node is naturally not read.
  • the first node in the buffer layer After the first node in the buffer layer is stored in the storage layer, the first node has completed storage. If a read operation occurs, the complete node can be read according to the first node stored in the storage layer. ⁇ Node data.
  • the nodes 301, 302, and 306 on the left side constitute a first storage tree that is persistently stored in the storage layer
  • R represents the first root node 301
  • B represents the first parent node 302, and needs to be in the first parent node 302. Add a new leaf node.
  • the storage tree on the right side represents the second storage tree newly created in the buffer layer
  • R1 represents the second root node 303
  • B1 represents the second parent node 304
  • A represents the newly added leaf node 305, where the second root node 303 is based on
  • the first node R is copied, and the key value is guaranteed to be unchanged, but the content is modified, that is, the pointing to the second parent node 304 is increased, and the second parent node 304 is copied according to the first parent node 302, and is the second.
  • the parent node 304 is assigned a new key value that is different from the original key value of the second parent node 304.
  • the content of the second parent node 304 needs to be modified to increase the pointing to the new leaf node 305, new The leaf node 305 is the first node.
  • the second storage tree is persistently stored in a storage layer in the distributed Key-Value storage system, that is, the second parent node 304 and the newly added leaf node 305 are first stored to In the storage layer in the distributed Key-Value storage system, the second root node 303 is stored in a storage layer in the distributed Key-Value storage system.
  • the second root node is stored in the storage layer of the Key-Value system, since the second root node is the same as the first root node, the first root node is covered by the second root node.
  • the first storage tree will be updated, and the newly added leaf node 305 is stored in the storage layer, that is, the data update is completed.
  • the pointing and content of the first root node 301 in the Key-Value system There will be no change.
  • the data query is performed, and the read operation cannot read the dirty data of the leaf node that is being updated.
  • the second root node 303 is stored in the storage layer after the second parent node 304 and the newly added leaf node 305, so that even if the newly added leaf node 305 has been stored in the storage layer, the The leaf node 305 is read in the storage layer. It can be seen that during the addition of the leaf node 305, the read operation cannot read the dirty data of the leaf node 305.
  • the second root node is 303 is stored in the storage layer, such that since the second root node 303 covers the first root node 301, the second root node 303 points to the second parent node 304, so that the second parent can be found according to the index.
  • the node 304, and querying the newly added leaf node 305 according to the second parent node 304, ensures the uniqueness of the data and avoids reading dirty data.
  • the storage method of the embodiment of the invention ensures that the read and write data can be simultaneously performed, thereby improving the processing efficiency of the system.
  • the parent node new key value and the new key value of each of the superior nodes are unique key values in the first storage tree to avoid the first storage.
  • the key values of the nodes in the tree are repeated.
  • the method may further include:
  • the new key value of the parent node is a key value obtained by replacing the version number in the original key value of the parent node with the new version number.
  • the new key value of each of the upper nodes is a key value obtained by replacing the version number in the original key value corresponding to each of the upper nodes with the new version number.
  • the original version number of the first root node in the first storage tree is the first version number
  • the new version number assigned by the copied first root node is the second version number
  • the first version number Unlike the second version number the second version number may be larger or smaller than the first version number.
  • the first version number is *****vl
  • the second version number is *****v2.
  • the version number in the method for adding a new index node is not limited to a certain form.
  • the first version number is ***** V A
  • the second version number is * ****vB.
  • the second version number is greater than the first version number. That is, adding 1 to the original version number, so that the number of version numbers is not limited and is not repeated.
  • the above key value + version number assignment method can guarantee the uniqueness of the key value in the distributed storage system.
  • Embodiment 2 of the present invention provides a data update method for a distributed key-value pair Key-Value storage system, where a storage layer in the distributed Key-Value storage system includes a first storage tree.
  • the first storage tree includes a first root node, and the method includes:
  • each of the upper nodes sequentially copy the parent node to other upper nodes on the branch of the first root node to the buffer layer of the distributed Key-Value storage system until reaching the root node, and for each upper level
  • the node assigns a new key value, and respectively adds a pointer to the next level node that assigns the new key value in the content of each of the superior nodes.
  • the new key value of each of the upper nodes is different from the corresponding original key value.
  • adding a point to the next-level node that assigns a new key value in the content of each of the upper-level nodes, respectively includes adding a new pair to the content of the upper-level node that is closest to the parent node. The pointer to the parent of the key value.
  • the contents of the first root node, the parent node, and the upper node in the storage layer are not in the content of the updated second node. Pointing, therefore, if a read operation occurs in the updated second node stored procedure, the first node in the storage layer will not be able to find the first node, and naturally the dirty data of the second node will not be read. 408.
  • the updated second node After the first node in the buffer layer is stored in the storage layer, the updated second node has completed storage. If a read operation occurs, the new node may be read according to the first node stored in the storage layer. The data of the second node after the complete update.
  • the nodes 501, 502, 506, and 507 on the left side constitute a first storage tree that is persistently stored in the storage layer
  • R represents the first root node 501
  • B represents the first parent node 502
  • A represents the first leaf.
  • the storage tree on the right represents the second storage tree newly created in the buffer layer
  • R1 represents the second root node 503
  • B1 represents the second parent node 504
  • A1 represents the second leaf node 505.
  • the second root node 503 is copied according to the first root node R, and the key value is guaranteed to be unchanged, but the content is modified, that is, the pointing to the second parent node 504 is increased, and the second parent node 504 is based on the first parent node. 502 is copied, and a new key value is assigned to the second parent node 504, the new key value is different from the original key value of the second parent node 504, and the content of the second parent node 504 needs to be modified to increase the second key value.
  • the second leaf node 505 is copied according to the first leaf node 506, and the second leaf node 505 is assigned a new key value, the new key value is different from the original key value of the second leaf node 505, and the second leaf node is The original content of 505 is updated to the new content of the second leaf node 505.
  • the second storage tree is persistently stored to a storage layer in the distributed Key-Value storage system, wherein the second parent node 504 and the second leaf node 505 are first stored to In the storage layer in the distributed Key-Value storage system, the second root node 503 is stored in a storage layer in the distributed Key-Value storage system.
  • the first root node 501 will be the second root node. 503.
  • the first storage tree is to be updated, and the second leaf node 505 is stored in the storage layer, that is, the data update is completed.
  • the second root node 503 Before the second root node 503 is stored in the storage layer, since the second root node 503 does not exist in the Key-Value system, the pointing and content of the first root node 501 in the Key-Value system There will be no change. At this time, the data query is performed, and the read operation cannot read the dirty data of the leaf node that is being updated.
  • the second root node 503 is stored in the storage layer after the second parent node 504 and the second leaf node 505, such that even if the second leaf node 505 has been stored in the storage layer, The second leaf node 505 is still not read in the storage layer according to the first storage tree.
  • the read operation cannot read the dirty data of the leaf node of the desired update.
  • the second root node 503 is stored in the storage layer.
  • the second node 503 points to the second parent node 504. Therefore, the second parent node 504 can be found according to the index, and the second leaf node 505 is queried according to the second parent node 504, thereby ensuring the uniqueness of the data. Avoid reading dirty data.
  • the storage method of the embodiment of the invention ensures that the read and write data can be simultaneously performed, thereby improving the processing efficiency of the system.
  • the new key value of the second node, the new key value of the parent node, and the new key value of each of the upper nodes are all unique key values in the first storage tree. To avoid duplication with the key values of the nodes in the first storage tree.
  • the method may further include:
  • the new key value of the second node is obtained by replacing the version number in the original key value of the second node with the new version number.
  • Key value the new key value of the parent node is a key value obtained by replacing the version number in the original key value of the parent node with the new version number, the new one of each upper node.
  • the key value is a key value obtained by replacing the version number in the original key value corresponding to each of the upper nodes with the new version number.
  • the original version number of the first root node in the first storage tree is the first version number
  • the new version number assigned by the copied first root node is the second version number.
  • the first version number is different from the second version number, and the second version number may be greater than or smaller than the first version number.
  • the first version number is *****vl
  • the second version number is *****v2.
  • the version number in the above method is not limited to a certain form.
  • the first version number is *****vA
  • the second version number is *****vB.
  • the second version number is one greater than the first version number. That is, adding 1 to the original version number, so that the number of version numbers is not limited and is not repeated.
  • the above key value + version number assignment method can guarantee the uniqueness of the key value in the distributed storage system.
  • the method provided in Embodiment 2 when the first version number of the second node is modified to be different from the second version number of the first version number, in order to delete redundant data, After the second root node is stored in the storage layer of the Key-Value system, reading the first version number; applying an exclusive lock corresponding to the first version number; after applying to the exclusive lock Adding an exclusive lock to the first version number; after adding an exclusive lock to the first version number, deleting the original second node in the first storage tree from the storage layer of the Key-Value system, Parent node, superior node, and first root node.
  • the pair cannot be These nodes perform read operations so that they can be deleted.
  • the embodiment 3 of the present invention provides a data update method for a distributed key-value pair Key-Value storage system, where the storage layer in the distributed Key-Value storage system includes a first storage tree.
  • the first storage tree includes a first root node, and the method includes:
  • adding a point to the next-level node that assigns a new key value in the content of each of the upper-level nodes, respectively includes adding a new pair to the content of the upper-level node that is closest to the parent node. The pointer to the parent of the key value.
  • the direction of the first-level node of the upper-level node before the allocation of the new key value in the content of the first root node may be modified to the first-level node of the upper-level node after the new key value is allocated. Pointing.
  • the third node cannot be found according to the first node stored in the storage layer, and the data of the third node cannot be read naturally.
  • the left nodes 701, 702, 705, and 706 constitute a first storage tree that is persistently stored in the storage layer
  • R represents a first root node 701
  • B represents a first parent node 702
  • A represents a deletion.
  • the storage tree on the right represents the second storage tree newly created in the buffer layer
  • R1 represents the second root node 703,
  • B1 represents the second parent node 704.
  • the second root node 703 is copied according to the first root node R, and the key value is guaranteed to be unchanged, but the content is modified, that is, the pointing to the second parent node 704 is increased, and the second parent node 704 is based on the first parent node.
  • the second storage tree is persistently stored to a storage layer in the distributed Key-Value storage system, that is, the second parent node 704 is first stored to the distributed Key-Value.
  • the second root node 703 is stored in the storage layer in the distributed Key-Value storage system.
  • the second root node is stored in the storage layer of the Key-Value system
  • the first root node is covered by the second root node.
  • the first storage tree will be updated, and the leaf node 705 will no longer be included in the second storage tree, that is, the data update is completed.
  • the second root node 703 is stored in the storage layer, since the Key-Value system does not have the second root node 703, the pointing and content of the first root node 701 in the Key-Value system There will be no change. At this time, the data query is performed, and the read operation cannot read the dirty data of the leaf node that is being updated.
  • the second root node 703 is stored in the storage layer after the second parent node 704, such that even if the second parent node 704 has been stored in the storage layer, the leaf node cannot be read in the storage layer. 705. Thus, in the process of deleting the leaf node 705, the read operation cannot read the dirty data of the leaf node 705.
  • the second root node 703 is stored in the storage layer, such that since the second root node 703 covers the first root node 701, the second root node 703 points Is the second parent node 704, but the second parent node 704 does not point to the leaf node 705, and cannot query the leaf node 705 according to the second parent node 704, ensuring the uniqueness of the data and avoiding reading Dirty data.
  • the storage method of the embodiment of the invention ensures that the read and write data can be simultaneously performed, thereby improving the processing efficiency of the system.
  • the new key value of the parent node of the third node and the new key value of each of the upper node are all unique key values in the first storage tree, to avoid The key values of the nodes in the first storage tree are repeated.
  • the method may further include:
  • Assigning a new version number to the copied first root node, and the new key value of the parent node is obtained by replacing the version number in the original key value of the parent node with the new version number.
  • the key value, the new key value of each of the upper nodes is a key value obtained by replacing the version number in the original key value corresponding to each of the upper nodes with the new version number.
  • the original version number of the first root node in the first storage tree is the first version number
  • the new version number assigned by the copied first root node is the second version number
  • the first version number Unlike the second version number
  • the second version number may be larger or smaller than the first version number.
  • the first version number is *****vl
  • the second version number is *****v2.
  • the version number in the above method is not limited to a certain form.
  • the first version number is *****vA
  • the second version number is *****vB.
  • the second version number is one greater than the first version number. That is, add 1 to the original version number. Make the number of version numbers unlimited and not repeated.
  • the above key value + version number assignment method can guarantee the uniqueness of the key value in the distributed storage system.
  • Embodiment 4 provides a method for reading an index node, including:
  • step 805 is performed: adding the shared lock to the re-read root node.
  • the version number corresponding to the shared lock does not match the version number of the root node after re-reading, the version number of the re-read root node is used as the version number of the currently read root node, and the method returns The step of obtaining a shared lock corresponding to the version number of the currently read root node, that is, returning to step 802.
  • the acquisition of the shared lock requires a certain waiting time. During the waiting time, the root node may be modified, and the version number may change. Therefore, after the shared lock is acquired, the sharing needs to be verified. Whether the version number corresponding to the lock is consistent with the version number of the root node after re-reading, If they are consistent, it indicates that the root node has not changed, and the shared lock is valid, and the shared lock can be added thereto. After the shared lock is added to the root node, it is possible to prevent data in the target node under the root node from being deleted during the read operation.
  • the version number corresponding to the shared lock does not match the version number of the root node after re-reading, it indicates that the root node changes, and the shared lock fails to the root node. Re-verify the shared lock corresponding to the version number of the root node.
  • the request for acquiring the shared lock is immediately timed out, that is, when the shared lock is not obtained in the first time, a timeout exception is immediately thrown.
  • the embodiment of the present invention further provides a server applying the above method, and the server may be a simple database Simple DB server.
  • Embodiment 5 provides a server, which includes:
  • the obtaining unit 901 is configured to obtain a first data update request, where the first data update request includes: adding a key value of the first node in a first storage tree in a storage layer in the distributed Key-Value storage system And content, the first storage tree includes a first root node;
  • the processing unit 902 is configured to copy the first root node into a buffer layer of the distributed Key-Value storage system, and further configured to determine a parent node of the first node, and copy the parent node to the In the buffer layer of the distributed Key-Value storage system, the parent node is assigned a new key value, and a pointer to the first node is added to the content of the parent node, where the parent node's new key The value is different from the original key value of the parent node; and is further used to sequentially copy the parent node to other superior nodes on the branch of the first root node to the buffer layer of the distributed Key-Value storage system Until the root node is reached, and a new key value is assigned to each of the upper nodes, and a pointer to a next-level node that assigns a new key value is added to the content of each of the upper-level nodes, wherein each The new key value of the upper node is different from the original key value thereof; and is further configured to add
  • a storage unit 903 configured to store the first node, a parent node of the first node, and a parent node of the parent node into a storage layer in the distributed Key-Value storage system; After storing the first node, the parent node of the first node, and the upper node of the parent node to the storage layer, storing the first root node to the first one in the storage layer Storage tree Medium.
  • the parent node new key value and the new key value of each of the superior nodes are unique key values in the first storage tree.
  • the processing unit 902 is further configured to: after copying the first root node into a buffer layer of the distributed Key-Value storage system, assigning a new version number to the copied first root node,
  • the new key value of the parent node is a key value obtained by replacing the version number in the original key value of the parent node with the new version number
  • the new key value of each of the upper node is The version number in the original key value corresponding to each of the upper nodes is replaced with the key value obtained after the new version number.
  • Embodiment 6 provides a server, which includes:
  • the obtaining unit 1001 is configured to obtain a second data update request, where the second data update request includes new content of the second node that needs to be updated;
  • the processing unit 1002 is configured to copy the first root node in the first storage tree in the storage layer of the distributed Key-Value storage system into the buffer layer of the distributed Key-Value storage system; Deriving the original key value of the second node and the original content into a buffer layer of the distributed Key-Value storage system, allocating a new key value to the second node, and updating the original content of the second node a new content of the second node, where the new key value of the second node is different from the original key value of the second node; and is further used to determine a parent node of the second node, and copy the parent Nodes to the buffer layer of the distributed Key-Value storage system, assigning a new key value to the parent node, and modifying a pointer to the second node having the original key value in the content of the parent node to have a new Pointing to the second node of the key value, wherein the new key value of the parent node is different from the original key value of the parent node; and
  • a storage unit 1003 configured to: use the second node, a parent node of the second node, and the parent
  • the upper node of the node is stored in the storage layer in the distributed Key-Value storage system; and is further configured to store the second node, the parent node of the second node, and the upper node of the parent node to After the storage layer, the first root node is stored in the first storage tree in the storage layer.
  • the new key value of the second node, the new key value of the parent node, and the new key value of each of the superior nodes are unique key values in the first storage tree.
  • the processing unit is further configured to: after copying the first root node into a buffer layer of the distributed Key-Value storage system, assign a new version number to the copied first root node; Then, the new key value of the second node is a key value obtained by replacing the version number in the original key value of the second node with the new version number, and the new key value of the parent node is Replacing the version number in the original key value of the parent node with the key value obtained after the new version number, and the new key value of each of the upper node is the original key corresponding to each of the upper nodes The version number in the value is replaced with the key value obtained after the new version number.
  • Embodiment 7 provides a server, which includes:
  • the obtaining unit 1101 is configured to obtain a third data update request, where the third data update request includes a third node that needs to be deleted;
  • the processing unit 1102 is configured to copy the first root node in the first storage tree in the storage layer in the distributed Key-Value storage system into the buffer layer of the distributed Key-Value storage system; a parent node of the third node, copying the parent node to a buffer layer of the distributed Key-Value storage system, assigning a new key value to the parent node, and deleting a content of the parent node Pointing at a third node, wherein the new key value of the parent node is different from the original key value of the parent node; and is further configured to sequentially copy the parent node to other superiors on the branch of the first root node Nodes are in a buffer layer of the distributed Key-Value storage system until reaching the root node, and assigning a new key value to each of the upper nodes, and adding a pair of allocations respectively in the content of each of the upper nodes Pointing to a next-level node of the new key value, wherein the new key value of each of the upper-level nodes
  • the new key value of the parent node of the third node and the new key value of each of the superior nodes are unique key values in the first storage tree.
  • the processing unit is further configured to: after copying the first root node into a buffer layer of the distributed Key-Value storage system, assign a new version number to the copied first root node; Then, the new key value of the parent node is a key value obtained by replacing the version number in the original key value of the parent node with the new version number, and the new key value of each of the upper node And a key value obtained by replacing the version number in the original key value corresponding to each of the upper nodes with the new version number.
  • Embodiment 8 provides a server, which includes:
  • the first reading unit 1201 is configured to read a root node in the index
  • the obtaining unit 1202 is configured to acquire a shared lock corresponding to the version number of the currently read root node, and the second reading unit 1203 is configured to re-read the root node after acquiring the shared lock; the verification unit 1204 And verifying that the version number corresponding to the shared lock is consistent with the version number of the root node after re-reading, and if the version number corresponding to the shared lock is consistent with the version number of the root node after re-reading, The root node after re-reading adds the shared lock;
  • a reading operation unit 1205 configured to perform an operation of reading a target node under the root node from a storage layer of a key-value pair Key-Value system after adding the shared lock to the re-read root node .
  • the verification unit 1204 is further configured to use the version number of the re-read root node as the root of the current read if the version number corresponding to the shared lock does not match the version number of the re-read root node.
  • the version number of the node such that the obtaining unit acquires a shared lock corresponding to the version number of the currently read root node.
  • Embodiment 9 provides a server, which includes: an input device 1301, an output The device 1302, the buffer memory 1303, and the processor 1304 (the number of the processors 1304 in the server may be one or more, and FIG. 13 takes a processor as an example).
  • the input device 1301, the output device 1302, the buffer memory 1303, and the processor 1304 may be connected by a bus or other means.
  • FIG. 13 is exemplified by a bus connection manner.
  • the input device 1301 is configured to acquire a first data update request, where the first data update request is included in a first storage tree in a storage layer in a distributed Key-Value storage system.
  • the first storage tree includes a first root node;
  • the processor 1304 is configured to perform the following steps: copying the first root node into the buffer memory 1303 And a method for determining a parent node of the first node, copying the parent node into the buffer memory 1303, assigning a new key value to the parent node, and adding the Pointing of the first node, wherein the new key value of the parent node is different from the original key value of the parent node; and further for sequentially copying the parent node to other superior nodes on the branch of the first root node Going to the buffer memory 1303 until the root node is reached, and assigning a new key value to each of the upper nodes, and adding a next level to the new key value in the content of each of the upper
  • the parent node new key value and the new key value of each of the superior nodes are unique key values in the first storage tree.
  • the processor is further configured to: after copying the first root node to the buffer memory 1303, assign a new version number to the copied first root node, and then the new key value of the parent node a key value obtained by replacing the version number in the original key value of the parent node with the new version number, the new key value of each of the upper nodes is the original corresponding to each of the upper nodes The version number in the key value is replaced with the key value obtained after the new version number.
  • Embodiment 10 provides a server, which includes: an input device 1301, an output device 1302, a buffer memory 1303, and a processor 1304 (the number of processors 1304 in the server may be For one or more, Figure 13 takes a processor as an example.
  • the input device 1301, the output device 1302, the buffer memory 1303, and the processor 1304 may be connected by a bus or other means.
  • FIG. 13 is exemplified by a bus connection manner.
  • the input device 1301 is configured to obtain a second data update request, where the second data update request includes new content of the second node that needs to be updated.
  • the processor 1304 is configured to: reproduce the first root node in the first storage tree in the storage layer of the distributed Key-Value storage system into the buffer memory 1303; Deriving the original key value of the second node and the original content into the buffer memory 1303, assigning a new key value to the second node, and updating the original content of the second node to the second node a new content, where the new key value of the second node is different from the original key value of the second node; and is further configured to determine a parent node of the second node, and copy the parent node to the buffer memory In 1303, a new key value is allocated to the parent node, and a pointer to the second node having the original key value in the content of the parent node is modified to a pointer of the second node having a new key value, where the parent The new key value of the node is different from the original key value of the parent node; and is also used to sequentially copy the parent node to other superior nodes on the branch of the first root node into
  • the new key value of the second node, the new key value of the parent node, and the new key value of each of the superior nodes are unique key values in the first storage tree.
  • the processor 1304 is further configured to: copy the first root node to the distributed After the key-value is stored in the buffer layer of the system, the first root node of the copy is assigned a new version number; then, the new key value of the second node is the original key value of the second node.
  • the version number is replaced with the key value obtained after the new version number, and the new key value of the parent node is obtained by replacing the version number in the original key value of the parent node with the new version number.
  • the key value of each of the upper nodes is a key value obtained by replacing the version number in the original key value corresponding to each of the upper nodes with the new version number.
  • Embodiment 11 provides a server, which includes: an input device 1301, an output The device 1302, the buffer memory 1303, and the processor 1304 (the number of the processors 1304 in the server may be one or more, and FIG. 13 takes a processor as an example).
  • the input device 1301, the output device 1302, the buffer memory 1303, and the processor 1304 may be connected by a bus or other means, wherein FIG. 13 takes a bus connection as an example.
  • the input device 1301 is configured to acquire a third data update request, where the third data update request includes a third node that needs to be deleted.
  • the processor 1304 is configured to: reproduce the first root node in the first storage tree in the storage layer in the distributed Key-Value storage system into the buffer memory 1303; a parent node of the third node, copying the parent node into the buffer memory 1303, assigning a new key value to the parent node, and deleting a pointer to the third node in the content of the parent node,
  • the new key value of the parent node is different from the original key value of the parent node; and is further used to sequentially copy the parent node to other upper-level nodes on the branch of the first root node to the buffer memory.
  • the processor 1304 is further configured to: after copying the first root node into a buffer layer of the distributed Key-Value storage system, assign a new version number to the copied first root node. Then, the new key value of the parent node is a key value obtained by replacing the version number in the original key value of the parent node with the new version number, and the new key of each upper node The value is a key value obtained by replacing the version number in the original key value corresponding to each of the upper nodes with the new version number.
  • Embodiment 12 provides a server including: an input device 1301, an output device 1302, a buffer memory 1303, and a processor. 1304 (The number of processors 1304 in the server may be one or more, and FIG. 13 takes a processor as an example).
  • the input device 1301, the output device 1302, the buffer memory 1303, and the processor 1304 may be connected by a bus or other means, wherein FIG. 13 is a bus connection manner.
  • the processor 1304 is configured to perform the following steps: reading a root node in the index to the buffer memory 1303;
  • the processor 1304 is further configured to: if the version number corresponding to the shared lock does not match the version number of the root node after re-reading, use the version number of the re-read root node as The version number of the currently read root node, returning the step of obtaining a shared lock corresponding to the version number of the currently read root node.
  • FIG. 14 is a block diagram showing the structure of still another embodiment of the server of the present invention.
  • the server 1405 of the embodiment of the present invention may also be configured by a physical module such as a processor 1401, a memory 1402, a bus 1403, and a communication interface 1404, where the memory 1402 is used to store a computer.
  • Executing instructions the processor 1401 is connected to the memory 1402 via the bus, and when the server 1405 is running, the processor 1401 executes the computer execution instructions stored by the memory 1402, and through the communication
  • the interface 1404 communicates with devices external to the cluster management device to cause the server to perform the data update method described in various embodiments of the present invention.
  • the present invention further provides a computer storage medium, wherein the computer storage medium may store a program, and when the program is executed, may include a part of each embodiment of the virtual network-based switch configuration method provided by the present invention. Or all steps.
  • the storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

An embodiment of the present invention provides a data update method for a distributed key value pair Key-Value storage system. A node that needs to be updated, a father node, an ascending node, a root node are duplicated to a buffer layer of the Key-Value storage system, and key values and content of the node that needs to be updated, the father node, and the ascending node are modified, and content of the root node is modified, so that these nodes are different from original nodes in a storage layer. According to the method in the present invention, the node that needs to be updated, the father node, and the ascending node are first stored into the storage layer, and then, the root node is stored to a key value pair system. Because the node that needs to be updated in the buffer layer is stored into the storage layer prior to the root node in the buffer layer, the node that needs to be updated cannot be read in a read operation generated in the storage process of the node that needs to be updated, thereby avoiding reading of dirty data. The present invention further provides a corresponding method and server for reading an index node.

Description

分布式存储***的数据更新方法及服务器 技术领域  Data update method and server for distributed storage system
本发明涉及数据处理领域, 特别是涉及处理索引节点的方法及服务器。 背景技术  The present invention relates to the field of data processing, and in particular, to a method and a server for processing an index node. Background technique
随着电子通信技术的发展, 电子数据的存储量不断增大, 用户对于数据存 储***的容量要求也不断提高。作为具有具备高可用性、 高可扩展性以及大容 量特点的分布式键值对 Key- Value存储***受到广大用户的欢迎。  With the development of electronic communication technology, the storage capacity of electronic data is increasing, and the capacity requirements of data storage systems are constantly increasing. As a distributed key-value pair with high availability, high scalability and large capacity, the Key-Value storage system is popular among users.
分布式键值对 Key- Value存储***是以键值对 Key- Value作为数据的组织 方式, 按照一定的哈希算法, 将这些 Key- Value分配在海量的节点上的存储系 统。 对于分布式 Key-Value存储***中的节点数据的处理, 可以通过基于分布 式 Key- Value存储***之上的分布式简单数据库*** SimpleDB实施查询及增 加、 修改、 删除等操作。 在对节点数据实施查询及增加、 修改、 删除等操作过 程中, 需要通过分布式索引来查找分布式 Key- Value存储***中的节点数据, 该分布式索引是由大量的 Key- Value构成,通常呈树状结构,存在一个根节点, 对应于分布式索引中的节点上的数据存储在分布式 Key- Value***中。 当通过 分布式索引进行处理节点数据时,存在同时进行写和读请求的情况, 这将导致 读取的数据可能是脏数据, 而非所要读取的修改前或修改后的数据。  Distributed Key-Value Pair The Key-Value storage system uses a key-value pair Key-Value as the organization of the data. According to a certain hash algorithm, these Key-Values are allocated to the storage system on a massive number of nodes. For the processing of node data in the distributed Key-Value storage system, the query can be performed, and operations such as adding, modifying, and deleting can be performed through the distributed simple database system SimpleDB based on the distributed Key-Value storage system. In the process of querying, adding, modifying, and deleting node data, it is necessary to search for node data in a distributed Key-Value storage system through a distributed index, which is composed of a large number of Key-Values, usually In a tree structure, there is a root node, and the data corresponding to the nodes in the distributed index is stored in the distributed Key-Value system. When processing node data through a distributed index, there are cases where both write and read requests occur, which causes the read data to be dirty data rather than the pre-modified or modified data to be read.
为了避免读取到脏数据, 目前主要是釆用分布式锁控制并发的方法进行读 和写操作。 具体的, 当实施读请求时, 需要获取一个分布式的共享锁, 对目标 节点加共享锁, 使得在读操作时, 对该目标节点的写请求被阻塞; 当实施写请 求时,需要获取一个分布式的排他锁,对目标节点加排他锁,使得在写操作时, 对该目标节点的读请求被阻塞。 因此, 釆用分布式锁控制并发的方法进行读和 写操作, 可以防止节点数据在修改的过程中被读取,确保读取到完整的节点数 据。 然而, 上述方法虽然能够避免读取脏数据, 但是并发性差, 不能够同时进 行读和写操作, 这削弱了分布式 Key-Value存储***的可用性。 例如, 在通过 分布式索引进行写操作时, 该写操作可能耗时数秒, 甚至数分钟, 这导致读操 作被大幅延迟, 严重影响了分布式 Key- Value存储***的可用性。 发明内容 本发明提供了一种分布式键值对 Key- Value存储***的数据更新方法以及 相应的服务器。 使用本发明方法, 不仅可以避免读取到脏数据, 而且实现了读 写并发。 In order to avoid reading dirty data, it is mainly used to perform read and write operations using distributed lock control concurrency. Specifically, when a read request is implemented, a distributed shared lock needs to be acquired, and a shared lock is added to the target node, so that a write request to the target node is blocked during a read operation; when a write request is implemented, a distribution needs to be acquired. The exclusive lock, which adds an exclusive lock to the target node, so that the read request to the target node is blocked during the write operation. Therefore, using the distributed lock control concurrency method for read and write operations can prevent the node data from being read during the modification process, ensuring that the complete node data is read. However, although the above method can avoid reading dirty data, the concurrency is poor and the read and write operations cannot be performed at the same time, which impairs the usability of the distributed Key-Value storage system. For example, when writing through a distributed index, the write operation can take several seconds, or even minutes, which causes the read operation to be significantly delayed, seriously affecting the availability of the distributed Key-Value storage system. Summary of the invention The invention provides a data update method for a distributed key-value pair Key-Value storage system and a corresponding server. By using the method of the invention, not only the dirty data can be avoided, but also the read and write concurrency is realized.
本发明第一方面提供一种新增索引节点的方法, 包括:  A first aspect of the present invention provides a method for adding an index node, including:
所述分布式 Key-Value存储***中的存储层包括第一存储树, 所述第一存 储树包括第一根节点, 所述方法包括:  The storage layer in the distributed Key-Value storage system includes a first storage tree, and the first storage tree includes a first root node, and the method includes:
获取第一数据更新请求, 其中, 所述第一数据更新请求包括需要在所述第 一存储树中增加第一节点的键值和内容;  Obtaining a first data update request, where the first data update request includes adding a key value and content of the first node in the first storage tree;
复制所述第一根节点到所述分布式 Key- Value存储***的緩冲层中; 确定所述第一节点的父节点, 复制所述父节点到所述分布式 Key- Value存 储***的緩冲层中, 为所述父节点分配新键值, 在所述父节点的内容中增加对 所述第一节点的指向, 其中, 所述父节点的新键值与所述父节点的原始键值不 同;  Copying the first root node to a buffer layer of the distributed Key-Value storage system; determining a parent node of the first node, and replicating the parent node to the distributed Key-Value storage system In the layer, assigning a new key value to the parent node, adding a pointer to the first node in the content of the parent node, where the new key value of the parent node and the original key of the parent node Different values;
依次复制所述父节点到所述第一根节点的分支上的其它上级节点到所述 分布式 Key- Value存储***的緩冲层中, 直到到达所述根节点, 并为每个上级 节点分配新键值,以及在所述每个上级节点的内容中分别增加对分配新键值的 下一级节点的指向, 其中, 所述每个上级节点的新键值与其对应的原始键值不 同;  And sequentially copying the parent node to other upper nodes on the branch of the first root node to the buffer layer of the distributed Key-Value storage system until reaching the root node, and allocating each upper node a new key value, and a pointer to a next-level node that assigns a new key value is added to the content of each of the upper-level nodes, wherein the new key value of each of the upper-level nodes is different from the original key value thereof;
在所述第一根节点的内容中增加对所述上级节点的第一级节点的指向,其 中 ,所述第一级节点为所述父节点到所述第一根节点的分支上距离所述根节点 最近的节点;  Adding a pointer to the first-level node of the upper-level node in the content of the first root node, where the first-level node is a distance from the parent node to a branch of the first root node The node closest to the root node;
将所述第一节点、所述第一节点的父节点以及所述父节点的上级节点存储 到所述分布式 Key- Value存储***中的存储层中;  And storing the first node, the parent node of the first node, and the upper node of the parent node into a storage layer in the distributed Key-Value storage system;
将所述第一根节点存储到所述分布式 Key- Value存储***中的存储层中的 所述第一存储树中。  The first root node is stored in the first storage tree in a storage tier in the distributed Key-Value storage system.
结合第一方面,在第一种可能的实现方式中, 所述父节点新键值和每个所 述上级节点的新键值都是所述第一存储树中的唯一键值。  In conjunction with the first aspect, in a first possible implementation, the parent node new key value and the new key value of each of the superior nodes are unique key values in the first storage tree.
结合第一方面的第一种可能的实现方式,在第二种可能的实现方式中,在 复制所述第一根节点到所述分布式 Key- Value存储***的緩冲层中之后, 所述 方法还包括: With reference to the first possible implementation manner of the first aspect, in a second possible implementation manner, after the copying the first root node into a buffer layer of the distributed Key-Value storage system, The method also includes:
为复制的第一根节点分配新的版本号;  Assign a new version number to the copied first root node;
则,所述父节点的新的键值为将所述父节点的原始键值中的版本号更换为 所述新的版本号后得到的键值,所述每个上级节点的新的键值为将所述每个上 级节点对应的原始键值中的版本号更换为所述新的版本号后得到的键值。  Then, the new key value of the parent node is a key value obtained by replacing the version number in the original key value of the parent node with the new version number, and the new key value of each of the upper node And a key value obtained by replacing the version number in the original key value corresponding to each of the upper nodes with the new version number.
本发明第二方面提供一种分布式键值对 Key- Value存储***的数据更新方 法, 所述分布式 Key-Value存储***中的存储层包括第一存储树, 所述第一存 储树包括第一根节点, 所述方法包括:  A second aspect of the present invention provides a data update method for a distributed key-value pair Key-Value storage system, where a storage layer in the distributed Key-Value storage system includes a first storage tree, and the first storage tree includes a first a node, the method includes:
获取第二数据更新请求, 其中, 所述第二数据更新请求包括需要更新的第 二节点的新内容;  Obtaining a second data update request, where the second data update request includes new content of the second node that needs to be updated;
复制所述第一根节点到所述分布式 Key- Value存储***的緩冲层中; 复制所述第二节点的原始键值和原始内容到所述分布式 Key- Value存储系 统的緩冲层中, 为所述第二节点分配新的键值, 并将所述第二节点的原始内容 更新为所述第二节点的新内容, 其中, 所述第二节点的新键值与所述第二节点 的原始键值不同;  Copying the first root node into a buffer layer of the distributed Key-Value storage system; copying the original key value of the second node and the original content to a buffer layer of the distributed Key-Value storage system Allocating a new key value to the second node, and updating the original content of the second node to the new content of the second node, where the new key value of the second node is related to the first The original key values of the two nodes are different;
确定所述第二节点的父节点, 复制所述父节点到所述分布式 Key- Value存 储***的緩冲层中, 为所述父节点分配新键值, 将所述父节点的内容中对具有 原始键值的第二节点的指向修改为具有新键值的第二节点的指向, 其中, 所述 父节点的新键值与所述父节点的原始键值不同;  Determining a parent node of the second node, copying the parent node to a buffer layer of the distributed Key-Value storage system, assigning a new key value to the parent node, and pairing the content of the parent node The pointing of the second node having the original key value is modified to be the pointing of the second node having the new key value, wherein the new key value of the parent node is different from the original key value of the parent node;
依次复制所述父节点到所述第一根节点的分支上的其它上级节点到所述 分布式 Key- Value存储***的緩冲层中, 直到到达所述根节点, 并为每个上级 节点分配新键值,以及在所述每个上级节点的内容中分别增加对分配新键值的 下一级节点的指向, 其中, 所述每个上级节点的新键值与其对应的原始键值不 同;  And sequentially copying the parent node to other upper nodes on the branch of the first root node to the buffer layer of the distributed Key-Value storage system until reaching the root node, and allocating each upper node a new key value, and a pointer to a next-level node that assigns a new key value is added to the content of each of the upper-level nodes, wherein the new key value of each of the upper-level nodes is different from the original key value thereof;
在所述第一根节点的内容中增加对所述上级节点的第一级节点的指向,其 中所述第一级节点为所述父节点到所述第一根节点的分支上距离所述根节点 最近的节点;  Adding a pointer to the first-level node of the upper-level node in the content of the first root node, where the first-level node is the distance from the parent node to the branch of the first root node The node closest to the node;
将所述第二节点、所述第二节点的父节点以及所述父节点的上级节点存储 到所述分布式 Key- Value存储***中的存储层中; 将所述第一根节点存储到所述分布式 Key- Value存储***中的存储层中的 所述第一存储树中。 And storing the second node, the parent node of the second node, and the upper node of the parent node into a storage layer in the distributed Key-Value storage system; The first root node is stored in the first storage tree in a storage tier in the distributed Key-Value storage system.
结合本发明的第二方面, 在本发明第二方面的第一种可能的实现方式中, 所述第二节点的新键值、父节点的新键值和每个所述上级节点的新键值都是所 述第一存储树中的唯一键值。  With reference to the second aspect of the present invention, in a first possible implementation manner of the second aspect of the present invention, a new key value of the second node, a new key value of the parent node, and a new key of each of the upper node The values are all unique key values in the first storage tree.
结合第二方面的第一种可能的实现方式,在第二种可能的实现方式中,在 复制所述第一根节点到所述分布式 Key- Value存储***的緩冲层中之后, 所述 方法还包括:  With reference to the first possible implementation of the second aspect, in a second possible implementation, after the first root node is copied to the buffer layer of the distributed Key-Value storage system, The method also includes:
为所述复制的第一根节点分配新的版本号;  Allocating a new version number to the first root node of the copy;
则,所述第二节点的新键值为将所述第二节点的原始键值中的版本号更换 为所述新的版本号后得到的键值,所述父节点的新的键值为将所述父节点的原 始键值中的版本号更换为所述新的版本号后得到的键值,所述每个上级节点的 新的键值为将所述每个上级节点对应的原始键值中的版本号更换为所述新的 版本号后得到的键值。  Then, the new key value of the second node is a key value obtained by replacing the version number in the original key value of the second node with the new version number, and the new key value of the parent node is Replacing the version number in the original key value of the parent node with the key value obtained after the new version number, and the new key value of each of the upper node is the original key corresponding to each of the upper nodes The version number in the value is replaced with the key value obtained after the new version number.
本发明第三方面提供一种分布式键值对 Key- Value存储***的数据更新方 法, 所述分布式 Key-Value存储***中的存储层包括第一存储树, 所述第一存 储树包括第一根节点, 所述方法包括:  A third aspect of the present invention provides a data update method for a distributed key-value pair Key-Value storage system, where a storage layer in the distributed Key-Value storage system includes a first storage tree, and the first storage tree includes a first a node, the method includes:
获取第三数据更新请求, 其中, 所述第三数据更新请求包括需要删除的第 三节点;  Obtaining a third data update request, where the third data update request includes a third node that needs to be deleted;
复制所述第一根节点到所述分布式 Key- Value存储***的緩冲层中; 确定所述第三节点的父节点, 复制所述父节点到所述分布式 Key- Value存 储***的緩冲层中, 为所述父节点分配新键值,删除所述父节点的内容中对所 述第三节点的指向,其中,所述父节点的新键值与所述父节点的原始键值不同; 依次复制所述父节点到所述第一根节点的分支上的其它上级节点到所述 分布式 Key- Value存储***的緩冲层中, 直到到达所述根节点, 并为每个上级 节点分配新键值,以及在所述每个上级节点的内容中分别增加对分配新键值的 下一级节点的指向, 其中, 所述每个上级节点的新键值与其对应的原始键值不 同;  Copying the first root node to a buffer layer of the distributed Key-Value storage system; determining a parent node of the third node, and replicating the parent node to the distributed Key-Value storage system In the layer, assigning a new key value to the parent node, deleting a pointer to the third node in the content of the parent node, where the new key value of the parent node and the original key value of the parent node Differentiating; sequentially copying the parent node to other superior nodes on the branch of the first root node to the buffer layer of the distributed Key-Value storage system until reaching the root node, and for each superior The node assigns a new key value, and respectively adds a pointer to a next-level node that assigns a new key value in the content of each of the upper-level nodes, wherein the new key value of each of the upper-level nodes and the original key value corresponding thereto Different
在所述第一根节点的内容中增加对所述上级节点的第一级节点的指向,其 中所述第一级节点为所述父节点到所述第一根节点的分支上距离所述根节点 最近的节点; Adding a pointer to the first-level node of the superior node in the content of the first root node, The first level node is a node that is closest to the root node on the branch of the parent node to the first root node;
将所述第三节点的父节点以及所述父节点的上级节点存储到所述分布式 Storing the parent node of the third node and the superior node of the parent node to the distributed
Key- Value存储***中的存储层中; Key-Value in the storage layer in the storage system;
将所述第一根节点存储到所述分布式 Key- Value存储***中的存储层中的 所述第一存储树中。  The first root node is stored in the first storage tree in a storage tier in the distributed Key-Value storage system.
结合本发明的第三方面, 在本发明第三方面的第一种可能的实现方式中, 所述第三节点的父节点的新键值和每个所述上级节点的新键值都是所述第 ― 存储树中的唯一键值。  With reference to the third aspect of the present invention, in a first possible implementation manner of the third aspect, the new key value of the parent node of the third node and the new key value of each of the upper node are The unique key value in the storage tree.
结合第三方面的第一种可能的实现方式,在第二种可能的实现方式中, 复 制所述第一根节点到所述分布式 Key- Value存储***的緩冲层中之后, 所述方 法还包括:  With the first possible implementation of the third aspect, in a second possible implementation, after the first root node is copied into the buffer layer of the distributed Key-Value storage system, the method Also includes:
为所述复制的第一根节点分配新的版本号; 则, 所述父节点的新的键值为 将所述父节点的原始键值中的版本号更换为所述新的版本号后得到的键值,所 述每个上级节点的新的键值为将所述每个上级节点对应的原始键值中的版本 号更换为所述新的版本号后得到的键值。  Allocating a new version number to the copied first root node; then, the new key value of the parent node is obtained by replacing the version number in the original key value of the parent node with the new version number The key value of each of the upper nodes is a key value obtained by replacing the version number in the original key value corresponding to each of the upper nodes with the new version number.
本发明的第四方面提供一种读索引节点的方法, 包括:  A fourth aspect of the present invention provides a method for reading an index node, including:
读取索引中的根节点;  Read the root node in the index;
获取与当前读取的根节点的版本号对应的共享锁;  Obtaining a shared lock corresponding to the version number of the currently read root node;
在获取所述共享锁之后, 重新读取所述根节点;  Retrieving the root node after acquiring the shared lock;
验证所述共享锁对应的版本号与重新读取后的根节点的版本号是否一致, 若所述共享锁对应的版本号与重新读取后的根节点的版本号一致,则对所述重 新读取后的根节点加所述共享锁;  Verifying that the version number corresponding to the shared lock is consistent with the version number of the root node after re-reading, and if the version number corresponding to the shared lock is consistent with the version number of the root node after re-reading, The root node after reading adds the shared lock;
在对所述重新读取后的根节点加所述共享锁之后, 执行从键值对 Key-Value***的存储层中读取所述根节点下的目标节点的操作。  After the shared lock is added to the re-read root node, an operation of reading the target node under the root node from the storage layer of the Key-Value system is performed.
结合第四方面, 在第一种可能的方式中, 所述读索引节点的方法还包括: 若所述共享锁对应的版本号与重新读取后的根节点的版本号不一致,则将所述 重新读取后的根节点的版本号作为当前读取的根节点的版本号,返回所述获取 与当前读取的根节点的版本号相对应的共享锁的步骤。 本发明第五方面提供一种服务器, 包括: With reference to the fourth aspect, in a first possible manner, the method for reading an index node further includes: if the version number corresponding to the shared lock does not match the version number of the re-read root node, The version number of the root node after re-reading is taken as the version number of the currently read root node, and the step of obtaining the shared lock corresponding to the version number of the currently read root node is returned. A fifth aspect of the present invention provides a server, including:
获取单元, 用于获取第一数据更新请求, 其中, 所述第一数据更新请求包 括需要在分布式 Key- Value存储***中的存储层中的第一存储树中增加第一节 点的键值和内容, 所述第一存储树包括第一根节点;  An obtaining unit, configured to acquire a first data update request, where the first data update request includes: adding a key value of the first node in a first storage tree in a storage layer in the distributed Key-Value storage system Content, the first storage tree includes a first root node;
处理单元, 用于复制所述第一根节点到所述分布式 Key- Value存储***的 緩冲层中; 还用于确定所述第一节点的父节点, 复制所述父节点到所述分布式 Key- Value存储***的緩冲层中, 为所述父节点分配新键值, 在所述父节点的 内容中增加对所述第一节点的指向, 其中, 所述父节点的新键值与所述父节点 的原始键值不同;还用于依次复制所述父节点到所述第一根节点的分支上的其 它上级节点到所述分布式 Key- Value存储***的緩冲层中, 直到到达所述根节 点, 并为每个上级节点分配新键值, 以及在所述每个上级节点的内容中分别增 加对分配新键值的下一级节点的指向, 其中, 所述每个上级节点的新键值与其 对应的原始键值不同;还用于在所述第一根节点的内容中增加对所述上级节点 的第一级节点的指向, 其中, 所述第一级节点为所述父节点到所述第一根节点 的分支上距离所述根节点最近的节点;  a processing unit, configured to copy the first root node into a buffer layer of the distributed Key-Value storage system; further configured to determine a parent node of the first node, and copy the parent node to the distribution In the buffer layer of the Key-Value storage system, assigning a new key value to the parent node, adding a pointer to the first node in the content of the parent node, where the new key value of the parent node Different from the original key value of the parent node; and used to sequentially copy the parent node to other upper nodes on the branch of the first root node to the buffer layer of the distributed Key-Value storage system, Until the root node is reached, and a new key value is assigned to each of the upper nodes, and a pointer to a next-level node that assigns a new key value is respectively added in the content of each of the upper-level nodes, wherein each of the The new key value of the upper node is different from the original key value thereof; and is further configured to add a pointer to the first level node of the upper node in the content of the first root node, where the first level node is The parent node a node on the branch of the first root node that is closest to the root node;
存储单元, 用于将所述第一节点、所述第一节点的父节点以及所述父节点 的上级节点存储到所述分布式 Key- Value存储***中的存储层中; 以及用于在 将所述第一节点、所述第一节点的父节点以及所述父节点的上级节点存储到所 述存储层之后, 将所述第一根节点存储到所述存储层中的所述第一存储树中。  a storage unit, configured to store the first node, a parent node of the first node, and a parent node of the parent node into a storage layer in the distributed Key-Value storage system; After the first node, the parent node of the first node, and the upper node of the parent node are stored in the storage layer, storing the first root node into the first storage in the storage layer In the tree.
结合本发明第五方面,在本发明第五方面的第一种可能的实现方式中, 所 述父节点新键值和每个所述上级节点的新键值都是所述第一存储树中的唯一 键值。  With reference to the fifth aspect of the present invention, in a first possible implementation manner of the fifth aspect of the present invention, the parent node new key value and the new key value of each of the upper node are all in the first storage tree. The unique key value.
结合本发明第五方面的第二种可能的实现方式,在本发明第五方面的第二 种可能的实现方式中,所述处理单元还用于在复制所述第一根节点到所述分布 式 Key- Value存储***的緩冲层中之后, 为复制的第一根节点分配新的版本号, 则所述父节点的新的键值为将所述父节点的原始键值中的版本号更换为所述 新的版本号后得到的键值,所述每个上级节点的新的键值为将所述每个上级节 点对应的原始键值中的版本号更换为所述新的版本号后得到的键值。  With the second possible implementation manner of the fifth aspect of the present invention, in a second possible implementation manner of the fifth aspect of the present invention, the processing unit is further configured to: copy the first root node to the distribution After the key-value storage system is in the buffer layer, a new version number is assigned to the copied first root node, and the new key value of the parent node is the version number in the original key value of the parent node. Replacing the key value obtained after the new version number, the new key value of each upper node is replacing the version number in the original key value corresponding to each of the upper nodes with the new version number The key value obtained afterwards.
本发明第六方面提供一种服务器, 包括: 获取单元, 用于获取第二数据更新请求, 其中, 所述第二数据更新请求包 括需要更新的第二节点的新内容; A sixth aspect of the present invention provides a server, including: An obtaining unit, configured to obtain a second data update request, where the second data update request includes new content of the second node that needs to be updated;
处理单元, 用于复制分布式 Key- Value存储***的存储层中的第一存储树 中的第一根节点到所述分布式 Key- Value存储***的緩冲层中; 还用于复制所 述第二节点的原始键值和原始内容到所述分布式 Key- Value存储***的緩冲层 中, 为所述第二节点分配新的键值, 并将所述第二节点的原始内容更新为所述 第二节点的新内容, 其中, 所述第二节点的新键值与所述第二节点的原始键值 不同; 还用于确定所述第二节点的父节点, 复制所述父节点到所述分布式 Key- Value存储***的緩冲层中, 为所述父节点分配新键值, 将所述父节点的 内容中对具有原始键值的第二节点的指向修改为具有新键值的第二节点的指 向, 其中, 所述父节点的新键值与所述父节点的原始键值不同; 还用于依次复 制所述父节点到所述第一根节点的分支上的其它上级节点到所述分布式 Key- Value存储***的緩冲层中, 直到到达所述根节点, 并为每个上级节点分 配新键值,以及在所述每个上级节点的内容中分别增加对分配新键值的下一级 节点的指向, 其中, 所述每个上级节点的新键值与其对应的原始键值不同; 还 用于在所述第一根节点的内容中增加对所述上级节点的第一级节点的指向,其 中所述第一级节点为所述父节点到所述第一根节点的分支上距离所述根节点 最近的节点;  a processing unit, configured to copy a first root node in a first storage tree in a storage layer of the distributed Key-Value storage system into a buffer layer of the distributed Key-Value storage system; The original key value of the second node and the original content are added to the buffer layer of the distributed Key-Value storage system, the new node is assigned a new key value, and the original content of the second node is updated to a new content of the second node, where the new key value of the second node is different from the original key value of the second node; and is further used to determine a parent node of the second node, and copy the parent node Going to the buffer layer of the distributed Key-Value storage system, assigning a new key value to the parent node, and modifying a pointer of the second node having the original key value in the content of the parent node to have a new key Pointing to a second node of the value, wherein the new key value of the parent node is different from the original key value of the parent node; and further for sequentially copying the parent node to the other branch of the first root node Upper node to the distribution In the buffer layer of the Key-Value storage system, until the root node is reached, and each new node is assigned a new key value, and the next step of assigning a new key value is added to the content of each of the upper nodes respectively. Pointing to the level node, wherein the new key value of each of the upper nodes is different from the original key value thereof; and is further configured to add, to the content of the first root node, the first level node of the upper node Pointing, wherein the first level node is a node from the parent node to a branch of the first root node that is closest to the root node;
存储单元, 用于将所述第二节点、所述第二节点的父节点以及所述父节点 的上级节点存储到所述分布式 Key- Value存储***中的存储层中; 还用于在将 所述第二节点、所述第二节点的父节点以及所述父节点的上级节点存储到所述 存储层中之后, 将所述第一根节点存储到所述存储层中的所述第一存储树中。  a storage unit, configured to store the second node, a parent node of the second node, and a parent node of the parent node into a storage layer in the distributed Key-Value storage system; After the second node, the parent node of the second node, and the upper node of the parent node are stored in the storage layer, storing the first root node to the first one in the storage layer In the storage tree.
结合本发明的第六方面, 在本发明第六方面的第一种可能的实现方式中, 所述第二节点的新键值、父节点的新键值和每个所述上级节点的新键值都是所 述第一存储树中的唯一键值。  With reference to the sixth aspect of the present invention, in a first possible implementation manner of the sixth aspect, the new key value of the second node, the new key value of the parent node, and the new key of each of the upper nodes The values are all unique key values in the first storage tree.
结合第六方面的第一可能的实现方式,在第二种可能的实现方式中, 所述 处理单元还用于在复制所述第一根节点到所述分布式 Key- Value存储***的緩 冲层中之后, 为所述复制的第一根节点分配新的版本号; 则, 所述第二节点的 新键值为将所述第二节点的原始键值中的版本号更换为所述新的版本号后得 到的键值,所述父节点的新的键值为将所述父节点的原始键值中的版本号更换 为所述新的版本号后得到的键值,所述每个上级节点的新的键值为将所述每个 上级节点对应的原始键值中的版本号更换为所述新的版本号后得到的键值。 In conjunction with the first possible implementation of the sixth aspect, in a second possible implementation, the processing unit is further configured to: buffer the first root node to the distributed Key-Value storage system After the layer, assigning a new version number to the copied first root node; then, the new key value of the second node is replacing the version number in the original key value of the second node with the new one After the version number The key value to which the new key value of the parent node is obtained by replacing the version number in the original key value of the parent node with the new version number, and the new key of each upper node The key value is a key value obtained by replacing the version number in the original key value corresponding to each of the upper nodes with the new version number.
本发明第七方面提供一种服务器, 包括:  A seventh aspect of the present invention provides a server, including:
获取单元, 用于获取第三数据更新请求, 其中, 所述第三数据更新请求包 括需要删除的第三节点;  An obtaining unit, configured to obtain a third data update request, where the third data update request includes a third node that needs to be deleted;
处理单元, 用于复制分布式 Key- Value存储***中的存储层中的第一存储 树中的第一根节点到所述分布式 Key- Value存储***的緩冲层中; 还用于确定 所述第三节点的父节点, 复制所述父节点到所述分布式 Key- Value存储***的 緩冲层中, 为所述父节点分配新键值,删除所述父节点的内容中对所述第三节 点的指向, 其中, 所述父节点的新键值与所述父节点的原始键值不同; 还用于 依次复制所述父节点到所述第一根节点的分支上的其它上级节点到所述分布 式 Key- Value存储***的緩冲层中, 直到到达所述根节点, 并为每个上级节点 分配新键值,以及在所述每个上级节点的内容中分别增加对分配新键值的下一 级节点的指向, 其中, 所述每个上级节点的新键值与其对应的原始键值不同; 还用于在所述第一根节点的内容中增加对所述上级节点的第一级节点的指向, 其中所述第一级节点为所述父节点到所述第一根节点的分支上距离所述根节 点最近的节点;  a processing unit, configured to copy a first root node in a first storage tree in a storage layer in the distributed Key-Value storage system into a buffer layer of the distributed Key-Value storage system; a parent node of the third node, copying the parent node to a buffer layer of the distributed Key-Value storage system, assigning a new key value to the parent node, and deleting the content of the parent node to the a pointing of the third node, where the new key value of the parent node is different from the original key value of the parent node; and is further configured to sequentially copy the parent node to other superior nodes on the branch of the first root node Going to the buffer layer of the distributed Key-Value storage system until reaching the root node, and assigning a new key value to each of the upper nodes, and adding a new pair to each of the contents of each of the upper nodes Pointing to a next-level node of the key value, wherein the new key value of each of the upper-level nodes is different from the original key value thereof; and is further configured to add, to the content of the first root node, the upper-level node First level Pointing to a point, wherein the first level node is a node from the parent node to a branch of the first root node that is closest to the root node;
存储单元,用于将所述第三节点的父节点以及所述父节点的上级节点存储 到所述分布式 Key- Value存储***中的存储层中; 还用于在将所述第三节点的 父节点以及所述父节点的上级节点存储到所述分布式 Key- Value存储***中的 存储层中之后, 将所述第一根节点存储到所述分布式 Key- Value存储***中的 存储层中的所述第一存储树中。  a storage unit, configured to store a parent node of the third node and a superior node of the parent node into a storage layer in the distributed Key-Value storage system; After the parent node and the upper node of the parent node are stored in the storage layer in the distributed Key-Value storage system, the first root node is stored in a storage layer in the distributed Key-Value storage system In the first storage tree.
结合本发明的第七方面, 在本发明第七方面的第一种可能的实现方式中, 所述第三节点的父节点的新键值和每个所述上级节点的新键值都是所述第 ― 存储树中的唯一键值。  With reference to the seventh aspect of the present invention, in a first possible implementation manner of the seventh aspect, the new key value of the parent node of the third node and the new key value of each of the upper node are The unique key value in the storage tree.
结合第七方面的第一种可能的实现方式,在第二种可能的实现方式中, 所 述处理单元还用于在复制所述第一根节点到所述分布式 Key- Value存储***的 緩冲层中之后, 为所述复制的第一根节点分配新的版本号; 则, 所述父节点的 新的键值为将所述父节点的原始键值中的版本号更换为所述新的版本号后得 到的键值,所述每个上级节点的新的键值为将所述每个上级节点对应的原始键 值中的版本号更换为所述新的版本号后得到的键值。 With reference to the first possible implementation manner of the seventh aspect, in a second possible implementation, the processing unit is further configured to: copy the first root node to the distributed Key-Value storage system After the layer is layered, a new version number is assigned to the first root node of the copy; The new key value is a key value obtained by replacing the version number in the original key value of the parent node with the new version number, and the new key value of each of the upper nodes is the each superior The version number in the original key value corresponding to the node is replaced with the key value obtained after the new version number.
本发明的第八方面提供一种服务器, 包括:  An eighth aspect of the present invention provides a server, including:
第一读取单元, 用于读取索引中的根节点;  a first reading unit, configured to read a root node in the index;
获取单元, 用于获取与当前读取的根节点的版本号对应的共享锁; 第二读取单元, 用于在获取所述共享锁之后, 重新读取所述根节点; 验证单元,用于验证所述共享锁对应的版本号与重新读取后的根节点的版 本号是否一致,若所述共享锁对应的版本号与重新读取后的根节点的版本号一 致, 则对所述重新读取后的根节点加所述共享锁;  a obtaining unit, configured to acquire a shared lock corresponding to a version number of the currently read root node; a second reading unit, configured to re-read the root node after acquiring the shared lock; Verifying that the version number corresponding to the shared lock is the same as the version number of the root node after re-reading. If the version number corresponding to the shared lock is the same as the version number of the root node after re-reading, The root node after reading adds the shared lock;
读操作单元, 用于在对所述重新读取后的根节点加所述共享锁之后,执行 从键值对 Key-Value***的存储层中读取所述根节点下的目标节点的操作。  And a read operation unit, configured to perform an operation of reading the target node under the root node from the storage layer of the Key-Value system from the key value after the shared lock is added to the re-read root node.
结合第八方面,在第一可能的方式中, 所述验证单元还用于若所述共享锁 对应的版本号与重新读取后的根节点的版本号不一致,则将所述重新读取后的 根节点的版本号作为当前读取的根节点的版本号,使得所述获取单元获取与当 前读取的根节点的版本号相对应的共享锁。  With reference to the eighth aspect, in a first possible manner, the verification unit is further configured to: if the version number corresponding to the shared lock does not match the version number of the root node after re-reading, The version number of the root node is the version number of the currently read root node, so that the obtaining unit acquires the shared lock corresponding to the version number of the currently read root node.
本发明的第九方面提供一种服务器, 包括处理器、 存储器、 总线和通信接 口; 所述存储器用于存储计算机执行指令, 所述处理器与所述存储器通过所述 总线连接, 当所述服务器运行时, 所述处理器执行所述存储器存储的所述计算 机执行指令, 并通过所述通信接口与所述服务器部的设备进行通信, 以使所述 服务器执行如上第一方面、第二方面、 第三方面及各种可能方式所述的分布式 键值对 Key- Value存储***的数据更新方法。  A ninth aspect of the present invention provides a server, including a processor, a memory, a bus, and a communication interface; the memory is configured to store a computer execution instruction, and the processor is connected to the memory through the bus, when the server In operation, the processor executes the computer-executed instructions stored in the memory, and communicates with the device of the server unit through the communication interface, so that the server performs the first aspect, the second aspect, The third aspect and the data update method of the distributed key-value pair Key-Value storage system described in various possible manners.
本发明的第十方面提供一种计算机可读介质, 包括计算机执行指令, 以供 计算机的处理器执行所述计算机执行指令时, 所述计算机执行如上第一方面、 第二方面、 第三方面及各种可能方式所述的分布式键值对 Key- Value存储*** 的数据更新方法。  A tenth aspect of the present invention provides a computer readable medium, comprising: computer executable instructions for executing, by a processor of a computer, the first aspect, the second aspect, the third aspect, and A data update method for a distributed key-value pair Key-Value storage system as described in various possible ways.
在本发明第一方面提供的一种分布式键值对 Key- Value存储***的数据更 新方法中, 在緩冲层中的第一根节点存储到所述存储层之前, 所述 Key- Value ***的存储层中没有能够用于查找所述第一节点的根节点, 无法读取到所述 Key-Value***中的所述第一节点。 当緩冲层中的第一根节点存储到所述存储 层之后, 所述第一节点也已经存储到所述存储层中, 此时所述第一节点的数据 已经确定, 从而避免从所述第一节点中读取到脏数据。 In a data update method of a distributed key-value pair Key-Value storage system provided by the first aspect of the present invention, the Key-Value system is before the first root node in the buffer layer is stored in the storage layer. There is no root node in the storage layer that can be used to find the first node, and cannot be read. The first node in the Key-Value system. After the first root node in the buffer layer is stored in the storage layer, the first node is also already stored in the storage layer, and the data of the first node has been determined, thereby avoiding Dirty data is read in the first node.
在本发明第二方面提供的一种分布式键值对 Key- Value存储***的数据更 新方法中, 在 Key-Value存储***的緩冲层中的根节点存储到存储层前, 只能 够根据存储层中的根节点, 查找到未更新的第二节点, 而不能在存储层中读取 到更新后的第二节点的数据。 在所述緩冲层中的根节点存储到所述存储层后, 由于更新后的第二节点也已经存储到所述存储层,而且可以根据新存储的根节 点查找到更新后的第二节点 ,从而避免从所述第二节点中读取到脏数据。因此, 在所述緩冲层中的第一根节点存储到所述存储层之前,以及在将第二节点存储 到所述存储层的过程中, 可以进行读操作, 该读操作可以读取到存储于所述存 储层中的未更新的第二节点, 而不会读取到脏数据。  In the data updating method of the distributed key-value pair Key-Value storage system provided by the second aspect of the present invention, the root node in the buffer layer of the Key-Value storage system is stored in the storage layer only according to the storage. The root node in the layer finds the second node that is not updated, and cannot read the data of the updated second node in the storage layer. After the root node in the buffer layer is stored in the storage layer, since the updated second node has also been stored to the storage layer, and the updated second node can be found according to the newly stored root node. So as to avoid reading dirty data from the second node. Therefore, before the first root node in the buffer layer is stored to the storage layer, and in the process of storing the second node to the storage layer, a read operation can be performed, and the read operation can be read. The unupdated second node stored in the storage layer does not read dirty data.
在本发明第三方面提供的一种分布式键值对 Key- Value存储***的数据更 新方法中,在将緩冲层的第一根节点存储到所述存储层之前, 可以根据存储层 中的第一根节点查找到所述存储层中的第三节点, 可以对其进行读操作, 而且 可以读取到完整的第三节点的数据,从而实现节点删除和读操作的并发, 同时 又避免读取到脏数据。 当緩冲层的第一根节点存储到所述存储层之后, 则无法 根据新存储到所述存储层中的第一根节点查找到第三节点。  In the data update method of the distributed key-value pair Key-Value storage system provided by the third aspect of the present invention, before the first root node of the buffer layer is stored in the storage layer, according to the storage layer The first node finds the third node in the storage layer, can read it, and can read the data of the complete third node, thereby achieving concurrent deletion of the node and read operation, and avoiding reading at the same time. Get dirty data. After the first root node of the buffer layer is stored to the storage layer, the third node cannot be found according to the first root node newly stored in the storage layer.
在本发明提供的读索引节点的方法中, 当获取的与当前读取的共享锁对应 的版本号与重新读取后的根节点的版本号一致, 则说明根节点未改变, 可以对 该根节点下的目标节点加所述共享锁, 再执行读操作。 当获取的共享锁对应的 版本号与重新读取后的根节点的版本号不一致, 则说明在获取到共享锁后,根 节点的版本号有所改变, 该获取的共享锁失效, 需要重新获取与该重新读取后 的根节点的版本号对应的共享锁。 因此,应用本发明提供的读索引节点的方法 可以确保验证通过的共享锁能够对目标节点成功加锁。 附图说明  In the method for reading an index node provided by the present invention, when the version number corresponding to the currently read shared lock is the same as the version number of the re-read root node, the root node is unchanged, and the root may be The target node under the node adds the shared lock and then performs a read operation. When the version number corresponding to the obtained shared lock is inconsistent with the version number of the root node after re-reading, the version number of the root node is changed after the shared lock is obtained, and the acquired shared lock is invalid, and needs to be re-acquired. A shared lock corresponding to the version number of the re-read root node. Therefore, the method of reading the index node provided by the present invention can ensure that the shared lock passed by the verification can successfully lock the target node. DRAWINGS
图 1是一种海量存储的***架构示意图;  1 is a schematic diagram of a system architecture of mass storage;
图 2是本发明实施例 1提供的一种分布式键值对 Key- Value存储***的数 据更新方法的流程示意图; 2 is a number of distributed key-value pair Key-Value storage systems according to Embodiment 1 of the present invention; According to the flow chart of the update method;
图 3是本发明实施例 1提供的节点分布示意图;  3 is a schematic diagram of a node distribution according to Embodiment 1 of the present invention;
图 4是本发明实施例 2提供的一种分布式键值对 Key- Value存储***的数 据更新方法的流程示意图;  4 is a schematic flowchart of a data update method for a distributed key-value pair Key-Value storage system according to Embodiment 2 of the present invention;
图 5是本发明实施例 2提供的节点分布示意图;  FIG. 5 is a schematic diagram of a node distribution according to Embodiment 2 of the present invention; FIG.
图 6是本发明实施例 3提供的一种分布式键值对 Key- Value存储***的数 据更新方法的流程示意图;  6 is a schematic flowchart of a data update method of a distributed key-value pair Key-Value storage system according to Embodiment 3 of the present invention;
图 7是本发明实施例 3提供的节点分布示意图;  7 is a schematic diagram of a node distribution according to Embodiment 3 of the present invention;
图 8是本发明实施例 4提供的读取索引节点的方法的流程示意图; 图 9是本发明实施例 5提供的一种服务器结构框图;  8 is a schematic flowchart of a method for reading an index node according to Embodiment 4 of the present invention; FIG. 9 is a block diagram of a server structure according to Embodiment 5 of the present invention;
图 10是本发明实施例 6提供的一种服务器结构框图;  FIG. 10 is a structural block diagram of a server according to Embodiment 6 of the present invention; FIG.
图 11是本发明实施例 7提供的一种服务器结构框图;  11 is a block diagram showing a structure of a server according to Embodiment 7 of the present invention;
图 12是本发明实施例 8提供的一种服务器结构框图;  12 is a block diagram showing a structure of a server according to Embodiment 8 of the present invention;
图 13是本发明提供的一种服务器的总线连接结构示意图;  13 is a schematic diagram of a bus connection structure of a server provided by the present invention;
图 14是本发明提供的又一种服务器的总线连接结构示意图。 具体实施方式  FIG. 14 is a schematic diagram of a bus connection structure of still another server provided by the present invention. detailed description
本发明实施例提供了一种分布式键值对 Key- Value存储***的数据更新 方法。 以下先介绍本发明实施例可以应用的场景。 如图 1所示。 图 1展示了可 以实施本发明实施例的***架构, 该***架构包括简单数据库 SDB的客户端 101、 网络层 Web layer 102、 緩冲层 Cache layer 103和存储层 Store layer 104, 其中, 存储层 104为 Key- Value存储***, 緩冲层 103主要提供许可服务 LC ( License Client ) Server。 在本发明实施例中, 对分布式索引的操作(如新增 索引节点、 修改索引节点等)是在緩冲层执行, 将需要存储的节点数据持久化 存储于存储层中。 以下对本发明实施例进行详细介绍。  Embodiments of the present invention provide a data update method for a distributed key-value pair Key-Value storage system. The following describes the scenarios in which the embodiments of the present invention can be applied. As shown in Figure 1. 1 shows a system architecture in which an embodiment of the present invention can be implemented. The system architecture includes a client 101 of a simple database SDB, a network layer Web layer 102, a buffer layer Cache layer 103, and a storage layer Store layer 104, wherein the storage layer 104 For the Key-Value storage system, the buffer layer 103 mainly provides a license service LC (License Client) Server. In the embodiment of the present invention, the operation of the distributed index (such as adding an index node, modifying the index node, etc.) is performed at the buffer layer, and the node data to be stored is persistently stored in the storage layer. The embodiments of the present invention are described in detail below.
如图 2所示, 实施例 1提供了一种分布式键值对 Key- Value存储***的数据 更新方法, 本实施例以增加索引节点为例, 所述分布式 Key- Value存储***中 的存储层包括第一存储树, 所述第一存储树包括第一根节点, 所述方法包括: 201、 获取第一数据更新请求, 其中, 所述第一数据更新请求包括需要在 所述第一存储树中增加第一节点的键值和内容。 202、 复制所述第一根节点到所述分布式 Key- Value存储***的緩冲层中。As shown in FIG. 2, Embodiment 1 provides a data update method for a distributed key-value pair Key-Value storage system. In this embodiment, an index node is added as an example, and the storage in the distributed Key-Value storage system is used. The layer includes a first storage tree, the first storage tree includes a first root node, and the method includes: 201: Acquire a first data update request, where the first data update request includes a need to be in the first storage Add the key value and content of the first node to the tree. 202. Copy the first root node into a buffer layer of the distributed Key-Value storage system.
203、 确定所述第一节点在所述第一存储树中的父节点, 复制所述父节点 到所述分布式 Key-Value存储***的緩冲层中, 为所述父节点分配新键值, 在 所述父节点的内容中增加对所述第一节点的指向。其中, 所述父节点的新键值 与所述父节点的原始键值不同。 203. Determine a parent node of the first node in the first storage tree, copy the parent node to a buffer layer of the distributed Key-Value storage system, and allocate a new key value to the parent node. Adding a pointer to the first node in the content of the parent node. The new key value of the parent node is different from the original key value of the parent node.
在所述緩冲层中, 对所述第一存储树中的父节点的键值和内容进行修改, 使得修改后的父节点的新键值不同于原始键值,而且其内容增加了对所述第一 节点的指向。  In the buffer layer, modifying the key value and content of the parent node in the first storage tree, so that the modified parent node's new key value is different from the original key value, and the content thereof is increased. The orientation of the first node.
204、 依次复制所述父节点到所述第一根节点的分支上的其它上级节点到 所述分布式 Key- Value存储***的緩冲层中, 直到到达所述根节点, 并为每个 上级节点分配新键值,以及在所述每个上级节点的内容中分别增加对分配新键 值的下一级节点的指向。其中, 所述每个上级节点的新键值与其对应的原始键 值不同。  Step 204: Copy the parent node to other upper nodes on the branch of the first root node to the buffer layer of the distributed Key-Value storage system, until the root node is reached, and for each upper level The node assigns a new key value, and respectively adds a pointer to the next level node that assigns the new key value in the content of each of the superior nodes. The new key value of each of the upper nodes is different from the corresponding original key value.
在本步骤中 ,在所述每个上级节点的内容中分别增加对分配新键值的下一 级节点的指向包括了最接近所述父节点的上级节点的内容中也增加了对分配 了新键值的父节点的指向。  In this step, adding a point to the next-level node that assigns a new key value in the content of each of the upper-level nodes, respectively, includes adding a new pair to the content of the upper-level node that is closest to the parent node. The pointer to the parent of the key value.
205、 在所述第一根节点的内容中增加对所述上级节点的第一级节点的指 向。其中, 所述第一级节点为所述父节点到所述第一根节点的分支上距离所述 根节点最近的节点。  205. Add a pointer to the first-level node of the upper-level node in the content of the first root node. The first level node is a node that is closest to the root node on the branch of the parent node to the first root node.
例如 ,可以将所述第一根节点的内容中的对分配新键值前的所述上级节点 的第一级节点的指向修改为对分配新键值后的所述上级节点的第一级节点的 指向。  For example, the direction of the first-level node of the upper-level node before the allocation of the new key value in the content of the first root node may be modified to the first-level node of the upper-level node after the new key value is allocated. Pointing.
206、 将所述第一节点、 所述第一节点的父节点以及所述父节点的上级节 点存储到所述分布式 Key- Value存储***中的存储层中。  206. Store the first node, the parent node of the first node, and the upper node of the parent node into a storage layer in the distributed Key-Value storage system.
此时, 由于緩冲层中的第一根节点还未存储到存储层中, 而存储层中原有 的第一根节点、 父节点和上级节点的内容中并没有对第一节点的指向, 因此, 若在所述第一节点在存储过程中发生读操作,根据存储层中的第一根节点将无 法查找到第一节点, 自然不会读到第一节点的脏数据。  At this time, since the first root node in the buffer layer is not yet stored in the storage layer, the content of the first root node, the parent node, and the upper node in the storage layer does not point to the first node, so If a read operation occurs in the storage process of the first node, the first node in the storage layer cannot find the first node, and the dirty data of the first node is naturally not read.
207、将所述第一根节点存储到所述分布式 Key- Value存储***中的存储层 中的所述第一存储树中。 207. Store the first root node in a storage layer in the distributed Key-Value storage system. In the first storage tree.
当緩冲层中的第一根节点存储到存储层后, 第一节点已经完成存储, 此时 若发生读操作,则可以根据新存储到存储层中的第一根节点读取到完整的第 ― 节点的数据。  After the first node in the buffer layer is stored in the storage layer, the first node has completed storage. If a read operation occurs, the complete node can be read according to the first node stored in the storage layer. ― Node data.
如图 3所示, 左侧的节点 301、 302和 306组成持久存储在存储层的第一存储 树, R表示第一根节点 301 , B表示第一父节点 302, 需要在第一父节点 302下增 加新的叶子节点。 右侧的存储树表示在緩冲层新建的第二存储树, R1表示第 二根节点 303 , B1表示第二父节点 304, A表示新增的叶子节点 305 , 这里的第 二根节点 303根据第一根节点 R复制得到, 保证其键值不变, 但内容有所修改, 即增加对第二父节点 304的指向,第二父节点 304根据第一父节点 302复制得到, 并为第二父节点 304分配了新键值,该新的键值与第二父节点 304的原始键值不 同, 第二父节点 304的内容需要进行修改, 以增加对新叶子节点 305的指向, 新 增的叶子节点 305即为第一节点。  As shown in FIG. 3, the nodes 301, 302, and 306 on the left side constitute a first storage tree that is persistently stored in the storage layer, R represents the first root node 301, and B represents the first parent node 302, and needs to be in the first parent node 302. Add a new leaf node. The storage tree on the right side represents the second storage tree newly created in the buffer layer, R1 represents the second root node 303, B1 represents the second parent node 304, and A represents the newly added leaf node 305, where the second root node 303 is based on The first node R is copied, and the key value is guaranteed to be unchanged, but the content is modified, that is, the pointing to the second parent node 304 is increased, and the second parent node 304 is copied according to the first parent node 302, and is the second. The parent node 304 is assigned a new key value that is different from the original key value of the second parent node 304. The content of the second parent node 304 needs to be modified to increase the pointing to the new leaf node 305, new The leaf node 305 is the first node.
在所述第二存储树建立之后, 将所述第二存储树持久化存储到分布式 Key- Value存储***中的存储层, 即先将第二父节点 304和新增的叶子节点 305 存储到所述分布式 Key- Value存储***中的存储层中, 再将第二根节点 303存储 到所述分布式 Key- Value存储***中的存储层中。  After the second storage tree is established, the second storage tree is persistently stored in a storage layer in the distributed Key-Value storage system, that is, the second parent node 304 and the newly added leaf node 305 are first stored to In the storage layer in the distributed Key-Value storage system, the second root node 303 is stored in a storage layer in the distributed Key-Value storage system.
在第二根节点存储到所述 Key- Value***的存储层之后, 由于所述第二根 节点与第一根节点键值相同, 所述第一根节点将被第二根节点覆盖,在所述存 储层中, 所述第一存储树将被更新, 新增的叶子节点 305被存储到存储层中, 即完成数据更新。  After the second root node is stored in the storage layer of the Key-Value system, since the second root node is the same as the first root node, the first root node is covered by the second root node. In the storage layer, the first storage tree will be updated, and the newly added leaf node 305 is stored in the storage layer, that is, the data update is completed.
在所述第二根节点 303存储到所述存储层之前, 由于所述 Key- Value***还 不存在第二根节点 303 , 而所述 Key- Value***中的第一根节点 301的指向和内 容都不会有改变,此时进行数据查询,读操作不可能读取到相关正在更新的叶 子节点的脏数据。 第二根节点 303在第二父节点 304和新增的叶子节点 305之 后才存储到存储层中, 这样即使新增的所述叶子节点 305已经存储到所述存储 层中, 仍然不能在所述存储层中读取到所述叶子节点 305。 由此可见, 在所述 叶子节点 305新增过程中,读操作不能够读取到所述叶子节点 305的脏数据。 当 所述叶子节点 305相关的第二存储树完全建立完毕之后, 才把所述第二根节点 303存储到所述存储层, 这样, 由于第二根节点 303覆盖了第一根节点 301 , 第 二根节点 303指向的是第二父节点 304, 因此, 能够根据索引查找到所述第二父 节点 304, 并根据第二父节点 304查询到新增的叶子节点 305 , 保证了数据的唯 一性并避免读取到脏数据。 同时, 本发明实施例的存储方法保证读写数据可以 同时进行, 提高了***的处理效率。 Before the second root node 303 is stored in the storage layer, since the Key-Value system does not have the second root node 303, the pointing and content of the first root node 301 in the Key-Value system There will be no change. At this time, the data query is performed, and the read operation cannot read the dirty data of the leaf node that is being updated. The second root node 303 is stored in the storage layer after the second parent node 304 and the newly added leaf node 305, so that even if the newly added leaf node 305 has been stored in the storage layer, the The leaf node 305 is read in the storage layer. It can be seen that during the addition of the leaf node 305, the read operation cannot read the dirty data of the leaf node 305. After the second storage tree associated with the leaf node 305 is completely established, the second root node is 303 is stored in the storage layer, such that since the second root node 303 covers the first root node 301, the second root node 303 points to the second parent node 304, so that the second parent can be found according to the index. The node 304, and querying the newly added leaf node 305 according to the second parent node 304, ensures the uniqueness of the data and avoids reading dirty data. At the same time, the storage method of the embodiment of the invention ensures that the read and write data can be simultaneously performed, thereby improving the processing efficiency of the system.
在上述实施例 1提供的方法中, 所述父节点新键值和每个所述上级节点的 新键值都是所述第一存储树中的唯一键值,以避免与所述第一存储树中的节点 的键值重复。  In the method provided in the foregoing Embodiment 1, the parent node new key value and the new key value of each of the superior nodes are unique key values in the first storage tree to avoid the first storage. The key values of the nodes in the tree are repeated.
在上述实施例 1提供的方法中, 在复制所述第一根节点到所述分布式 Key- Value存储***的緩冲层中之后, 所述方法还可以包括:  In the method provided by the foregoing Embodiment 1, after the first root node is copied to the buffer layer of the distributed Key-Value storage system, the method may further include:
为复制的第一根节点分配新的版本号,则所述父节点的新的键值为将所述 父节点的原始键值中的版本号更换为所述新的版本号后得到的键值,所述每个 上级节点的新的键值为将所述每个上级节点对应的原始键值中的版本号更换 为所述新的版本号后得到的键值。  Assigning a new version number to the copied first root node, the new key value of the parent node is a key value obtained by replacing the version number in the original key value of the parent node with the new version number. The new key value of each of the upper nodes is a key value obtained by replacing the version number in the original key value corresponding to each of the upper nodes with the new version number.
例如, 所述第一存储树中的第一根节点的原分配的版本号为第一版本号, 复制的第一根节点分配的新的版本号为第二版本号,所述第一版本号与所述第 二版本号不同, 所述第二版本号可以大于或小于所述第一版本号。如所述第一 版本号为 *****vl , 所述第二版本号为 *****v2。 需要说明的是, 上述新增索引 节点的方法中的版本号并不局限于某一种形式, 例如, 所述第一版本号为 *****VA, 所述第二版本号为 *****vB。 For example, the original version number of the first root node in the first storage tree is the first version number, and the new version number assigned by the copied first root node is the second version number, the first version number Unlike the second version number, the second version number may be larger or smaller than the first version number. If the first version number is *****vl, the second version number is *****v2. It should be noted that the version number in the method for adding a new index node is not limited to a certain form. For example, the first version number is ***** V A, and the second version number is * ****vB.
由于可能需要在一个父节点下多次增加叶子节点, 为了避免版本号重复, 优选的, 所述第二版本号比所述第一版本号大 1。 即在原版本号的基础上加 1 , 使得版本号数量不受限制且不重复。  Since the leaf node may need to be added multiple times under one parent node, in order to avoid duplication of the version number, preferably, the second version number is greater than the first version number. That is, adding 1 to the original version number, so that the number of version numbers is not limited and is not repeated.
上述键值 +版本号的分配方法, 可以保证键值在分布式存储***中的唯一 性。  The above key value + version number assignment method can guarantee the uniqueness of the key value in the distributed storage system.
如图 4所示, 本发明实施例 2提供了一种分布式键值对 Key- Value存储*** 的数据更新方法, 所述分布式 Key- Value存储***中的存储层包括第一存储树, 所述第一存储树包括第一根节点, 所述方法包括:  As shown in FIG. 4, Embodiment 2 of the present invention provides a data update method for a distributed key-value pair Key-Value storage system, where a storage layer in the distributed Key-Value storage system includes a first storage tree. The first storage tree includes a first root node, and the method includes:
401、 获取第二数据更新请求, 其中, 所述第二数据更新请求包括需要更 新的第二节点的新内容。 401. Acquire a second data update request, where the second data update request includes a need for more New content for the new second node.
402、 复制所述第一根节点到所述分布式 Key- Value存储***的緩冲层中。 403、 复制所述第二节点的原始键值和原始内容到所述分布式 Key- Value存 储***的緩冲层中, 为所述第二节点分配新的键值, 并将所述第二节点的原始 内容更新为所述第二节点的新内容。其中, 所述第二节点的新键值与所述第二 节点的原始键值不同。  402. Copy the first root node into a buffer layer of the distributed Key-Value storage system. 403. Copy the original key value and the original content of the second node into a buffer layer of the distributed Key-Value storage system, allocate a new key value to the second node, and allocate the second node. The original content is updated to the new content of the second node. The new key value of the second node is different from the original key value of the second node.
404、 确定所述第二节点的父节点, 复制所述父节点到所述分布式 Key- Value存储***的緩冲层中, 为所述父节点分配新键值, 将所述父节点的 内容中对具有原始键值的第二节点的指向修改为具有新键值的第二节点的指 向。 其中, 所述父节点的新键值与所述父节点的原始键值不同。  404. Determine a parent node of the second node, copy the parent node into a buffer layer of the distributed Key-Value storage system, allocate a new key value to the parent node, and set a content of the parent node. The pointer to the second node with the original key value is modified to point to the second node with the new key value. The new key value of the parent node is different from the original key value of the parent node.
405、 依次复制所述父节点到所述第一根节点的分支上的其它上级节点到 所述分布式 Key- Value存储***的緩冲层中, 直到到达所述根节点, 并为每个 上级节点分配新键值,以及在所述每个上级节点的内容中分别增加对分配新键 值的下一级节点的指向。其中, 所述每个上级节点的新键值与其对应的原始键 值不同。  405. sequentially copy the parent node to other upper nodes on the branch of the first root node to the buffer layer of the distributed Key-Value storage system until reaching the root node, and for each upper level The node assigns a new key value, and respectively adds a pointer to the next level node that assigns the new key value in the content of each of the superior nodes. The new key value of each of the upper nodes is different from the corresponding original key value.
在本步骤中 ,在所述每个上级节点的内容中分别增加对分配新键值的下一 级节点的指向包括了最接近所述父节点的上级节点的内容中也增加了对分配 了新键值的父节点的指向。  In this step, adding a point to the next-level node that assigns a new key value in the content of each of the upper-level nodes, respectively, includes adding a new pair to the content of the upper-level node that is closest to the parent node. The pointer to the parent of the key value.
406、 在所述第一根节点的内容中增加对所述上级节点的第一级节点的指 向,其中所述第一级节点为所述父节点到所述第一根节点的分支上距离所述根 节点最近的节点。  406. Add a pointer to a first-level node of the upper-level node in a content of the first root node, where the first-level node is a distance from the parent node to a branch of the first root node. The node closest to the root node.
例如 ,将所述第一根节点的内容中的对分配新键值前的所述上级节点的第 一级节点的指向修改为对分配新键值后的所述上级节点的第一级节点的指向。  For example, modifying a direction of the first-level node of the upper-level node before assigning a new key value in the content of the first root node to a first-level node of the upper-level node after allocating a new key value direction.
407、 将所述第二节点、 所述第二节点的父节点以及所述父节点的上级节 点存储到所述分布式 Key- Value存储***中的存储层中。  407. Store the second node, the parent node of the second node, and the upper node of the parent node into a storage layer in the distributed Key-Value storage system.
此时, 由于緩冲层中的第一根节点还未存储到存储层中, 而存储层中原有 的第一根节点、 父节点和上级节点的内容中并没有对更新后的第二节点的指 向, 因此, 若在更新后的第二节点存储过程中发生读操作, 根据存储层中的第 一根节点将无法查找到第一节点, 自然不会读到第二节点的脏数据。 408、将所述第一根节点存储到所述分布式 Key- Value存储***中的存储层 中的所述第一存储树中。 At this time, since the first root node in the buffer layer has not been stored in the storage layer, the contents of the first root node, the parent node, and the upper node in the storage layer are not in the content of the updated second node. Pointing, therefore, if a read operation occurs in the updated second node stored procedure, the first node in the storage layer will not be able to find the first node, and naturally the dirty data of the second node will not be read. 408. Store the first root node in the first storage tree in a storage layer in the distributed Key-Value storage system.
当緩冲层中的第一根节点存储到存储层后,更新后的第二节点已经完成存 储, 此时若发生读操作, 则可以根据新存储到存储层中的第一根节点读取到完 整的更新后的第二节点的数据。  After the first node in the buffer layer is stored in the storage layer, the updated second node has completed storage. If a read operation occurs, the new node may be read according to the first node stored in the storage layer. The data of the second node after the complete update.
如图 5所示, 左侧的节点 501、 502、 506和 507组成持久存储在存储层的第 一存储树, R表示第一根节点 501 , B表示第一父节点 502, A表示第一叶子节点 506, 需要修改第一叶子节点。右侧的存储树表示在緩冲层新建的第二存储树, R1表示第二根节点 503 , B1表示第二父节点 504, A1表示第二叶子节点 505。 这 里的第二根节点 503根据第一根节点 R复制得到, 保证其键值不变, 但内容有 所修改, 即增加对第二父节点 504的指向, 第二父节点 504根据第一父节点 502 复制得到, 并为第二父节点 504分配了新键值, 该新的键值与第二父节点 504 的原始键值不同, 第二父节点 504的内容需要进行修改, 以增加对第二叶子节 点 505的指向。 第二叶子节点 505根据第一叶子节点 506复制得到, 并为第二叶 子节点 505分配了新键值,该新的键值与第二叶子节点 505的原始键值不同, 以 及将第二叶子节点 505的原始内容更新为第二叶子节点 505的新内容。  As shown in FIG. 5, the nodes 501, 502, 506, and 507 on the left side constitute a first storage tree that is persistently stored in the storage layer, R represents the first root node 501, B represents the first parent node 502, and A represents the first leaf. Node 506, the first leaf node needs to be modified. The storage tree on the right represents the second storage tree newly created in the buffer layer, R1 represents the second root node 503, B1 represents the second parent node 504, and A1 represents the second leaf node 505. Here, the second root node 503 is copied according to the first root node R, and the key value is guaranteed to be unchanged, but the content is modified, that is, the pointing to the second parent node 504 is increased, and the second parent node 504 is based on the first parent node. 502 is copied, and a new key value is assigned to the second parent node 504, the new key value is different from the original key value of the second parent node 504, and the content of the second parent node 504 needs to be modified to increase the second key value. The pointing of the leaf node 505. The second leaf node 505 is copied according to the first leaf node 506, and the second leaf node 505 is assigned a new key value, the new key value is different from the original key value of the second leaf node 505, and the second leaf node is The original content of 505 is updated to the new content of the second leaf node 505.
在所述第二存储树建立之后, 将所述第二存储树持久化存储到分布式 Key- Value存储***中的存储层,其中,先将第二父节点 504和第二叶子节点 505 存储到所述分布式 Key- Value存储***中的存储层中, 再将第二根节点 503存储 到所述分布式 Key- Value存储***中的存储层中。  After the second storage tree is established, the second storage tree is persistently stored to a storage layer in the distributed Key-Value storage system, wherein the second parent node 504 and the second leaf node 505 are first stored to In the storage layer in the distributed Key-Value storage system, the second root node 503 is stored in a storage layer in the distributed Key-Value storage system.
在第二根节点 503存储到所述 Key- Value***的存储层之后, 由于所述第二 根节点 503与第一根节点 501键值相同,所述第一根节点 501将被第二根节点 503 覆盖, 在所述存储层中, 所述第一存储树将被更新, 第二叶子节点 505被存储 到存储层中, 即完成数据更新。  After the second root node 503 stores the storage layer of the Key-Value system, since the second root node 503 has the same key value as the first root node 501, the first root node 501 will be the second root node. 503. In the storage layer, the first storage tree is to be updated, and the second leaf node 505 is stored in the storage layer, that is, the data update is completed.
在所述第二根节点 503存储到所述存储层之前, 由于所述 Key- Value***还 不存在第二根节点 503 , 而所述 Key- Value***中的第一根节点 501的指向和内 容都不会有改变,此时进行数据查询,读操作不可能读取到相关正在更新的叶 子节点的脏数据。 第二根节点 503在第二父节点 504和第二叶子节点 505之后才 存储到存储层中, 这样即使所述第二叶子节点 505已经存储到所述存储层中, 仍然不能根据第一存储树在所述存储层中读取到第二叶子节点 505。由此可见, 在叶子节点的更新过程中, 读操作不能够读取到所需更新的叶子节点的脏数 据。 当第二叶子节点 505相关的第二存储树完全建立完毕之后, 才把所述第二 根节点 503存储到所述存储层, 这样, 由于第二根节点 503覆盖了第一根节点 501 , 第二根节点 503指向的是第二父节点 504, 因此, 能够根据索引查找到所 述第二父节点 504, 并根据第二父节点 504查询到第二叶子节点 505 , 保证了数 据的唯一性并避免读取到脏数据。 同时, 本发明实施例的存储方法保证读写数 据可以同时进行, 提高了***的处理效率。 Before the second root node 503 is stored in the storage layer, since the second root node 503 does not exist in the Key-Value system, the pointing and content of the first root node 501 in the Key-Value system There will be no change. At this time, the data query is performed, and the read operation cannot read the dirty data of the leaf node that is being updated. The second root node 503 is stored in the storage layer after the second parent node 504 and the second leaf node 505, such that even if the second leaf node 505 has been stored in the storage layer, The second leaf node 505 is still not read in the storage layer according to the first storage tree. It can be seen that during the update process of the leaf node, the read operation cannot read the dirty data of the leaf node of the desired update. After the second storage tree associated with the second leaf node 505 is completely established, the second root node 503 is stored in the storage layer. Thus, since the second root node 503 covers the first root node 501, The second node 503 points to the second parent node 504. Therefore, the second parent node 504 can be found according to the index, and the second leaf node 505 is queried according to the second parent node 504, thereby ensuring the uniqueness of the data. Avoid reading dirty data. At the same time, the storage method of the embodiment of the invention ensures that the read and write data can be simultaneously performed, thereby improving the processing efficiency of the system.
在上述实施例 2提供的方法中, 所述第二节点的新键值、 父节点的新键值 和每个所述上级节点的新键值都是所述第一存储树中的唯一键值,以避免与所 述第一存储树中的节点的键值重复。  In the method provided in Embodiment 2, the new key value of the second node, the new key value of the parent node, and the new key value of each of the upper nodes are all unique key values in the first storage tree. To avoid duplication with the key values of the nodes in the first storage tree.
在上述实施例 2提供的方法中, 在复制所述第一根节点到所述分布式 Key- Value存储***的緩冲层中之后, 所述方法还可以包括:  In the method provided in the foregoing Embodiment 2, after the first root node is copied to the buffer layer of the distributed Key-Value storage system, the method may further include:
为所述复制的第一根节点分配新的版本号,则所述第二节点的新键值为将 所述第二节点的原始键值中的版本号更换为所述新的版本号后得到的键值,所 述父节点的新的键值为将所述父节点的原始键值中的版本号更换为所述新的 版本号后得到的键值,所述每个上级节点的新的键值为将所述每个上级节点对 应的原始键值中的版本号更换为所述新的版本号后得到的键值。  Assigning a new version number to the copied first root node, and the new key value of the second node is obtained by replacing the version number in the original key value of the second node with the new version number. Key value, the new key value of the parent node is a key value obtained by replacing the version number in the original key value of the parent node with the new version number, the new one of each upper node The key value is a key value obtained by replacing the version number in the original key value corresponding to each of the upper nodes with the new version number.
例如, 所述第一存储树中的第一根节点的原分配的版本号为第一版本号, 复制的第一根节点分配的新的版本号为第二版本号。所述第一版本号与所述第 二版本号不同, 所述第二版本号可以大于或小于所述第一版本号。如所述第一 版本号为 *****vl , 所述第二版本号为 *****v2。 需要说明的是, 上述方法中的 版本号并不局限于某一种形式, 例如, 所述第一版本号为 *****vA, 所述第二 版本号为 *****vB。  For example, the original version number of the first root node in the first storage tree is the first version number, and the new version number assigned by the copied first root node is the second version number. The first version number is different from the second version number, and the second version number may be greater than or smaller than the first version number. If the first version number is *****vl, the second version number is *****v2. It should be noted that the version number in the above method is not limited to a certain form. For example, the first version number is *****vA, and the second version number is *****vB.
由于可能需要在一个父节点下多次修改叶子节点, 为了避免版本号重复, 优选的, 所述第二版本号比所述第一版本号大 1。 即在原版本号的基础上加 1 , 使得版本号数量不受限制且不重复。  Since the leaf node may need to be modified multiple times under one parent node, in order to avoid duplication of the version number, preferably, the second version number is one greater than the first version number. That is, adding 1 to the original version number, so that the number of version numbers is not limited and is not repeated.
上述键值 +版本号的分配方法, 可以保证键值在分布式存储***中的唯一 性。 在实施例 2提供的方法中, 当将所述第二节点的键值中的第一版本号修改 为不同于所述第一版本号的第二版本号时, 为了删除冗余数据,在将所述第二 根节点存储到所述 Key-Value***的存储层中之后, 读取所述第一版本号; 申 请与所述第一版本号对应的排他锁; 在申请到所述排他锁之后,对所述第一版 本号加排他锁; 在对所述第一版本号加排他锁之后, 从所述 Key- Value***的 存储层中删除所述第一存储树中原有的第二节点、 父节点、上级节点和第一根 节点。 由于原有的第二节点、 父节点、 上级节点和第一根节点的键值中都包含 有所述第一版本号, 因此, 在对所述第一版本号加排他锁后, 就不能对上述这 些节点进行读操作, 从而可以将它们删除。 The above key value + version number assignment method can guarantee the uniqueness of the key value in the distributed storage system. In the method provided in Embodiment 2, when the first version number of the second node is modified to be different from the second version number of the first version number, in order to delete redundant data, After the second root node is stored in the storage layer of the Key-Value system, reading the first version number; applying an exclusive lock corresponding to the first version number; after applying to the exclusive lock Adding an exclusive lock to the first version number; after adding an exclusive lock to the first version number, deleting the original second node in the first storage tree from the storage layer of the Key-Value system, Parent node, superior node, and first root node. Since the first version number is included in the key values of the original second node, the parent node, the upper node, and the first root node, after the exclusive lock is added to the first version number, the pair cannot be These nodes perform read operations so that they can be deleted.
如图 6所示, 本发明实施例 3提供了一种分布式键值对 Key- Value存储*** 的数据更新方法, 所述分布式 Key- Value存储***中的存储层包括第一存储树, 所述第一存储树包括第一根节点, 所述方法包括:  As shown in FIG. 6, the embodiment 3 of the present invention provides a data update method for a distributed key-value pair Key-Value storage system, where the storage layer in the distributed Key-Value storage system includes a first storage tree. The first storage tree includes a first root node, and the method includes:
601、 获取第三数据更新请求, 其中, 所述第三数据更新请求包括需要删 除的第三节点。  601. Acquire a third data update request, where the third data update request includes a third node that needs to be deleted.
602、 复制所述第一根节点到所述分布式 Key- Value存储***的緩冲层中。 602. Copy the first root node into a buffer layer of the distributed Key-Value storage system.
603、 确定所述第三节点的父节点, 复制所述父节点到所述分布式 Key- Value存储***的緩冲层中, 为所述父节点分配新键值, 删除所述父节点 的内容中对所述第三节点的指向。其中, 所述父节点的新键值与所述父节点的 原始键值不同。 603. Determine a parent node of the third node, copy the parent node to a buffer layer of the distributed Key-Value storage system, assign a new key value to the parent node, and delete the content of the parent node. Pointing to the third node. The new key value of the parent node is different from the original key value of the parent node.
604、 依次复制所述父节点到所述第一根节点的分支上的其它上级节点到 所述分布式 Key- Value存储***的緩冲层中, 直到到达所述根节点, 并为每个 上级节点分配新键值,以及在所述每个上级节点的内容中分别增加对分配新键 值的下一级节点的指向。其中, 所述每个上级节点的新键值与其对应的原始键 值不同。  604. Copy the parent node to other upper nodes on the branch of the first root node to the buffer layer of the distributed Key-Value storage system, until the root node is reached, and for each superior The node assigns a new key value, and respectively adds a pointer to the next level node that assigns the new key value in the content of each of the superior nodes. The new key value of each of the upper nodes is different from the corresponding original key value.
在本步骤中,在所述每个上级节点的内容中分别增加对分配新键值的下一 级节点的指向包括了最接近所述父节点的上级节点的内容中也增加了对分配 了新键值的父节点的指向。  In this step, adding a point to the next-level node that assigns a new key value in the content of each of the upper-level nodes, respectively, includes adding a new pair to the content of the upper-level node that is closest to the parent node. The pointer to the parent of the key value.
605、 在所述第一根节点的内容中增加对所述上级节点的第一级节点的指 向,其中所述第一级节点为所述父节点到所述第一根节点的分支上距离所述根 节点最近的节点。 605. Add a pointer to a first-level node of the upper-level node in a content of the first root node, where the first-level node is a distance from the parent node to a branch of the first root node. Root The node closest to the node.
例如 ,可以将所述第一根节点的内容中的对分配新键值前的所述上级节点 的第一级节点的指向修改为对分配新键值后的所述上级节点的第一级节点的 指向。  For example, the direction of the first-level node of the upper-level node before the allocation of the new key value in the content of the first root node may be modified to the first-level node of the upper-level node after the new key value is allocated. Pointing.
606、 将所述第三节点的父节点以及所述父节点的上级节点存储到所述分 布式 Key- Value存储***中的存储层中。  606. Store the parent node of the third node and the upper node of the parent node into a storage layer in the distributed Key-Value storage system.
此时, 由于緩冲层中的第一根节点还未存储到存储层中, 而存储层中原有 的第三节点仍然存在, 因此, 若在緩冲层中的第一根节点存储到存储层之前发 生读操作, 根据存储层中的第一根节点将读到原有的第三节点的完整数据。  At this time, since the first node in the buffer layer is not yet stored in the storage layer, and the original third node in the storage layer still exists, if the first node in the buffer layer is stored in the storage layer Before the read operation occurs, the complete data of the original third node will be read according to the first node in the storage layer.
607、将所述第一根节点存储到所述分布式 Key- Value存储***中的存储层 中的所述第一存储树中。  607. Store the first root node in the first storage tree in a storage layer in the distributed Key-Value storage system.
当緩冲层中的第一根节点存储到存储层后,根据新存储到存储层中的第一 根节点将无法查找到第三节点, 自然无法读取到第三节点的数据。  After the first node in the buffer layer is stored in the storage layer, the third node cannot be found according to the first node stored in the storage layer, and the data of the third node cannot be read naturally.
如图 7所示, 左侧的节点 701、 702、 705和 706组成持久存储在存储层的第 一存储树, R表示第一根节点 701 , B表示第一父节点 702, A表示需删除的叶子 节点 705。 右侧的存储树表示在緩冲层新建的第二存储树, R1表示第二根节点 703 , B1表示第二父节点 704。 这里的第二根节点 703根据第一根节点 R复制得 到, 保证其键值不变, 但内容有所修改, 即增加对第二父节点 704的指向, 第 二父节点 704根据第一父节点 702复制得到,并为第二父节点 704分配了新键值, 该新的键值与第二父节点 304的原始键值不同,删除第二父节点 704的内容中对 需删除的所述叶子节点 705的指向。  As shown in FIG. 7, the left nodes 701, 702, 705, and 706 constitute a first storage tree that is persistently stored in the storage layer, R represents a first root node 701, B represents a first parent node 702, and A represents a deletion. Leaf node 705. The storage tree on the right represents the second storage tree newly created in the buffer layer, R1 represents the second root node 703, and B1 represents the second parent node 704. Here, the second root node 703 is copied according to the first root node R, and the key value is guaranteed to be unchanged, but the content is modified, that is, the pointing to the second parent node 704 is increased, and the second parent node 704 is based on the first parent node. 702 is copied, and a new key value is assigned to the second parent node 704. The new key value is different from the original key value of the second parent node 304. The content of the second parent node 704 is deleted from the content of the second parent node 704. The pointing of node 705.
在所述第二存储树建立之后, 将所述第二存储树持久化存储到分布式 Key- Value存储***中的存储层, 即先将第二父节点 704存储到所述分布式 Key- Value存储***中的存储层中, 再将第二根节点 703存储到所述分布式 Key- Value存储***中的存储层中。  After the second storage tree is established, the second storage tree is persistently stored to a storage layer in the distributed Key-Value storage system, that is, the second parent node 704 is first stored to the distributed Key-Value. In the storage layer in the storage system, the second root node 703 is stored in the storage layer in the distributed Key-Value storage system.
在第二根节点存储到所述 Key- Value***的存储层之后, 由于所述第二根 节点与第一根节点键值相同, 所述第一根节点将被第二根节点覆盖,在所述存 储层中, 所述第一存储树将被更新, 第二存储树中将不再包含所述叶子节点 705 , 即完成数据更新。 在所述第二根节点 703存储到所述存储层之前, 由于所述 Key- Value***还 不存在第二根节点 703 , 而所述 Key- Value***中的第一根节点 701的指向和内 容都不会有改变,此时进行数据查询,读操作不可能读取到相关正在更新的叶 子节点的脏数据。 第二根节点 703在第二父节点 704之后才存储到存储层中, 这 样即使第二父节点 704已经存储到所述存储层中, 仍然不能在所述存储层中读 取到所述叶子节点 705。 由此可见, 在删除所述叶子节点 705的过程中, 读操作 不能够读取到所述叶子节点 705的脏数据。 当所述第二存储树完全建立完毕之 后, 才把所述第二根节点 703存储到所述存储层, 这样, 由于第二根节点 703 覆盖了第一根节点 701 , 第二根节点 703指向的是第二父节点 704, 但第二父节 点 704并不指向所述叶子节点 705 , 不能够根据第二父节点 704查询到所述叶子 节点 705 , 保证了数据的唯一性并避免读取到脏数据。 同时, 本发明实施例的 存储方法保证读写数据可以同时进行, 提高了***的处理效率。 After the second root node is stored in the storage layer of the Key-Value system, since the second root node is the same as the first root node, the first root node is covered by the second root node. In the storage layer, the first storage tree will be updated, and the leaf node 705 will no longer be included in the second storage tree, that is, the data update is completed. Before the second root node 703 is stored in the storage layer, since the Key-Value system does not have the second root node 703, the pointing and content of the first root node 701 in the Key-Value system There will be no change. At this time, the data query is performed, and the read operation cannot read the dirty data of the leaf node that is being updated. The second root node 703 is stored in the storage layer after the second parent node 704, such that even if the second parent node 704 has been stored in the storage layer, the leaf node cannot be read in the storage layer. 705. Thus, in the process of deleting the leaf node 705, the read operation cannot read the dirty data of the leaf node 705. After the second storage tree is completely established, the second root node 703 is stored in the storage layer, such that since the second root node 703 covers the first root node 701, the second root node 703 points Is the second parent node 704, but the second parent node 704 does not point to the leaf node 705, and cannot query the leaf node 705 according to the second parent node 704, ensuring the uniqueness of the data and avoiding reading Dirty data. At the same time, the storage method of the embodiment of the invention ensures that the read and write data can be simultaneously performed, thereby improving the processing efficiency of the system.
在上述实施例 3提供的方法中, 所述第三节点的父节点的新键值和每个所 述上级节点的新键值都是所述第一存储树中的唯一键值,以避免与所述第一存 储树中的节点的键值重复。  In the method provided in the foregoing Embodiment 3, the new key value of the parent node of the third node and the new key value of each of the upper node are all unique key values in the first storage tree, to avoid The key values of the nodes in the first storage tree are repeated.
在上述实施例 3提供的方法中, 在复制所述第一根节点到所述分布式 Key- Value存储***的緩冲层中之后, 所述方法还可以包括:  In the method provided in the foregoing Embodiment 3, after the first root node is copied to the buffer layer of the distributed Key-Value storage system, the method may further include:
为所述复制的第一根节点分配新的版本号,则所述父节点的新的键值为将 所述父节点的原始键值中的版本号更换为所述新的版本号后得到的键值,所述 每个上级节点的新的键值为将所述每个上级节点对应的原始键值中的版本号 更换为所述新的版本号后得到的键值。  Assigning a new version number to the copied first root node, and the new key value of the parent node is obtained by replacing the version number in the original key value of the parent node with the new version number. The key value, the new key value of each of the upper nodes is a key value obtained by replacing the version number in the original key value corresponding to each of the upper nodes with the new version number.
例如, 所述第一存储树中的第一根节点的原分配的版本号为第一版本号, 复制的第一根节点分配的新的版本号为第二版本号,所述第一版本号与所述第 二版本号不同, 所述第二版本号可以大于或小于所述第一版本号。如所述第一 版本号为 *****vl , 所述第二版本号为 *****v2。 需要说明的是, 上述方法中的 版本号并不局限于某一种形式, 例如, 所述第一版本号为 *****vA, 所述第二 版本号为 *****vB。  For example, the original version number of the first root node in the first storage tree is the first version number, and the new version number assigned by the copied first root node is the second version number, the first version number Unlike the second version number, the second version number may be larger or smaller than the first version number. If the first version number is *****vl, the second version number is *****v2. It should be noted that the version number in the above method is not limited to a certain form. For example, the first version number is *****vA, and the second version number is *****vB.
由于可能需要在一个父节点下删除多个叶子节点, 为了避免版本号重复, 优选的, 所述第二版本号比所述第一版本号大 1。 即在原版本号的基础上加 1 , 使得版本号数量不受限制且不重复。 Since it is possible to delete multiple leaf nodes under one parent node, in order to avoid duplication of the version number, preferably, the second version number is one greater than the first version number. That is, add 1 to the original version number. Make the number of version numbers unlimited and not repeated.
上述键值 +版本号的分配方法, 可以保证键值在分布式存储***中的唯一 性。  The above key value + version number assignment method can guarantee the uniqueness of the key value in the distributed storage system.
在实施例 3提供的方法中, 当将所述第一父节点的键值中的第一版本号修 改为不同于所述第一版本号的第二版本号, 为了删除冗余数据,在将所述第二 根节点持久化存储到所述 Key- Value***中的存储层之后, 读取所述第一版本 号; 申请与所述第一版本号对应的排他锁; 在申请到所述排他锁之后, 对所述 第一版本号加排他锁; 在对所述第一版本号加排他锁之后, 从所述 Key- Value ***中的存储层中删除所述第一存储树中原有的第三节点、 父节点、上级节点 和第一根节点。 由于原有的第三节点、 父节点、 上级节点和第一根节点都包含 有所述第一版本号, 因此, 在对所述第一版本号加排他锁后, 就不能对上述这 些节点进行读操作, 从而可以将它们删除。  In the method provided in Embodiment 3, when the first version number of the first parent node is modified to a second version number different from the first version number, in order to delete redundant data, After the second root node is persistently stored in the storage layer in the Key-Value system, reading the first version number; applying an exclusive lock corresponding to the first version number; applying to the exclusive version After the lock, the exclusive lock is added to the first version number; after the exclusive lock is added to the first version number, the original number in the first storage tree is deleted from the storage layer in the Key-Value system Three nodes, a parent node, a superior node, and a first root node. Since the original third node, the parent node, the superior node, and the first root node all include the first version number, after the exclusive lock is added to the first version number, the nodes cannot be performed on the nodes. Read operations so they can be deleted.
为了在实施上述新增、 修改、 删除索引节点过程中进行读操作, 如图 8所 示, 实施例 4提供了一种读索引节点的方法, 包括:  In order to perform a read operation in the process of implementing the above-mentioned adding, modifying, and deleting an index node, as shown in FIG. 8, Embodiment 4 provides a method for reading an index node, including:
801、 读取索引中的根节点。  801. Read the root node in the index.
802、 获取与当前读取的根节点的版本号对应的共享锁。  802. Obtain a shared lock corresponding to a version number of the currently read root node.
803、 在获取所述共享锁之后, 重新读取所述根节点。  803. After obtaining the shared lock, re-read the root node.
804、 验证所述共享锁对应的版本号与重新读取后的根节点的版本号是否 一致。  804. Verify that the version number corresponding to the shared lock is consistent with the version number of the root node after re-reading.
若所述共享锁对应的版本号与重新读取后的根节点的版本号一致,则执行 步骤 805: 对所述重新读取后的根节点加所述共享锁。  If the version number corresponding to the shared lock is consistent with the version number of the re-read root node, step 805 is performed: adding the shared lock to the re-read root node.
若所述共享锁对应的版本号与重新读取后的根节点的版本号不一致,则将 所述重新读取后的根节点的版本号作为当前读取的根节点的版本号,返回所述 获取与当前读取的根节点的版本号相对应的共享锁的步骤, 即返回步骤 802。  If the version number corresponding to the shared lock does not match the version number of the root node after re-reading, the version number of the re-read root node is used as the version number of the currently read root node, and the method returns The step of obtaining a shared lock corresponding to the version number of the currently read root node, that is, returning to step 802.
806、 在对所述重新读取后的根节点加所述共享锁之后, 执行从键值对 806. Perform a slave key value pair after adding the shared lock to the re-read root node.
Key-Value***的存储层中读取所述根节点下的目标节点的操作。 The operation of reading the target node under the root node in the storage layer of the Key-Value system.
由于获取所述共享锁需要一定等待时间,在这段等待时间中, 所述根节点 有可能发生修改, 其版本号可能发生变化, 因此, 在获取所述共享锁之后, 还 需要验证所述共享锁对应的版本号与重新读取后的根节点的版本号是否一致, 若一致, 则表明根节点未发生改变, 该所述共享锁有效, 可以对其加所述共享 锁。 在对所述根节点加共享锁后, 可以避免在读操作过程中, 所述根节点下的 目标节点中的数据被删除。若所述共享锁对应的版本号与重新读取后的根节点 的版本号不一致,则表明所述根节点发生变化,所述共享锁对所述根节点失效, 此时, 需要重新获取与所述根节点的版本号对应的共享锁, 重新进行验证。 The acquisition of the shared lock requires a certain waiting time. During the waiting time, the root node may be modified, and the version number may change. Therefore, after the shared lock is acquired, the sharing needs to be verified. Whether the version number corresponding to the lock is consistent with the version number of the root node after re-reading, If they are consistent, it indicates that the root node has not changed, and the shared lock is valid, and the shared lock can be added thereto. After the shared lock is added to the root node, it is possible to prevent data in the target node under the root node from being deleted during the read operation. If the version number corresponding to the shared lock does not match the version number of the root node after re-reading, it indicates that the root node changes, and the shared lock fails to the root node. Re-verify the shared lock corresponding to the version number of the root node.
在获取与所述根节点的版本号对应的共享锁时,获取所述共享锁的请求釆 用立即超时的方式,即当第一时间获取不到所述共享锁时,立即抛出超时异常。  When the shared lock corresponding to the version number of the root node is obtained, the request for acquiring the shared lock is immediately timed out, that is, when the shared lock is not obtained in the first time, a timeout exception is immediately thrown.
本发明实施例还提供了应用上述方法的服务器,该服务器可以为简单数据 库 Simple DB服务器。  The embodiment of the present invention further provides a server applying the above method, and the server may be a simple database Simple DB server.
对应于实施例 1中的一种分布式键值对 Key- Value存储***的数据更新方 法, 如图 9所示, 实施例 5提供了一种服务器, 其包括:  Corresponding to the data update method of the distributed key-value pair Key-Value storage system in Embodiment 1, as shown in FIG. 9, Embodiment 5 provides a server, which includes:
获取单元 901 , 用于获取第一数据更新请求, 其中, 所述第一数据更新请 求包括需要在分布式 Key- Value存储***中的存储层中的第一存储树中增加第 一节点的键值和内容, 所述第一存储树包括第一根节点;  The obtaining unit 901 is configured to obtain a first data update request, where the first data update request includes: adding a key value of the first node in a first storage tree in a storage layer in the distributed Key-Value storage system And content, the first storage tree includes a first root node;
处理单元 902, 用于复制所述第一根节点到所述分布式 Key- Value存储*** 的緩冲层中; 还用于确定所述第一节点的父节点, 复制所述父节点到所述分布 式 Key- Value存储***的緩冲层中, 为所述父节点分配新键值, 在所述父节点 的内容中增加对所述第一节点的指向, 其中, 所述父节点的新键值与所述父节 点的原始键值不同;还用于依次复制所述父节点到所述第一根节点的分支上的 其它上级节点到所述分布式 Key-Value存储***的緩冲层中, 直到到达所述根 节点, 并为每个上级节点分配新键值, 以及在所述每个上级节点的内容中分别 增加对分配新键值的下一级节点的指向, 其中, 所述每个上级节点的新键值与 其对应的原始键值不同;还用于在所述第一根节点的内容中增加对所述上级节 点的第一级节点的指向, 其中, 所述第一级节点为所述父节点到所述第一根节 点的分支上距离所述根节点最近的节点;  The processing unit 902 is configured to copy the first root node into a buffer layer of the distributed Key-Value storage system, and further configured to determine a parent node of the first node, and copy the parent node to the In the buffer layer of the distributed Key-Value storage system, the parent node is assigned a new key value, and a pointer to the first node is added to the content of the parent node, where the parent node's new key The value is different from the original key value of the parent node; and is further used to sequentially copy the parent node to other superior nodes on the branch of the first root node to the buffer layer of the distributed Key-Value storage system Until the root node is reached, and a new key value is assigned to each of the upper nodes, and a pointer to a next-level node that assigns a new key value is added to the content of each of the upper-level nodes, wherein each The new key value of the upper node is different from the original key value thereof; and is further configured to add a pointer to the first level node of the upper node in the content of the first root node, where the first level node For the father's day To the first branch of the root node from the root node nearest node;
存储单元 903 , 用于将所述第一节点、 所述第一节点的父节点以及所述父 节点的上级节点存储到所述分布式 Key- Value存储***中的存储层中; 以及用 于在将所述第一节点、所述第一节点的父节点以及所述父节点的上级节点存储 到所述存储层之后,将所述第一根节点存储到所述存储层中的所述第一存储树 中。 a storage unit 903, configured to store the first node, a parent node of the first node, and a parent node of the parent node into a storage layer in the distributed Key-Value storage system; After storing the first node, the parent node of the first node, and the upper node of the parent node to the storage layer, storing the first root node to the first one in the storage layer Storage tree Medium.
在实施例 5提供的服务器中, 所述父节点新键值和每个所述上级节点的新 键值都是所述第一存储树中的唯一键值。  In the server provided in Embodiment 5, the parent node new key value and the new key value of each of the superior nodes are unique key values in the first storage tree.
优选的, 所述处理单元 902还用于在复制所述第一根节点到所述分布式 Key- Value存储***的緩冲层中之后, 为复制的第一根节点分配新的版本号, 则所述父节点的新的键值为将所述父节点的原始键值中的版本号更换为所述 新的版本号后得到的键值,所述每个上级节点的新的键值为将所述每个上级节 点对应的原始键值中的版本号更换为所述新的版本号后得到的键值。  Preferably, the processing unit 902 is further configured to: after copying the first root node into a buffer layer of the distributed Key-Value storage system, assigning a new version number to the copied first root node, The new key value of the parent node is a key value obtained by replacing the version number in the original key value of the parent node with the new version number, and the new key value of each of the upper node is The version number in the original key value corresponding to each of the upper nodes is replaced with the key value obtained after the new version number.
对应于实施例 2中的一种分布式键值对 Key- Value存储***的数据更新方 法, 如图 10所示, 实施例 6提供了一种服务器, 其包括:  Corresponding to a data update method of a distributed key-value pair Key-Value storage system in Embodiment 2, as shown in FIG. 10, Embodiment 6 provides a server, which includes:
获取单元 1001 , 用于获取第二数据更新请求, 其中, 所述第二数据更新请 求包括需要更新的第二节点的新内容;  The obtaining unit 1001 is configured to obtain a second data update request, where the second data update request includes new content of the second node that needs to be updated;
处理单元 1002 , 用于复制分布式 Key- Value存储***的存储层中的第一存 储树中的第一根节点到所述分布式 Key- Value存储***的緩冲层中; 还用于复 制所述第二节点的原始键值和原始内容到所述分布式 Key- Value存储***的緩 冲层中, 为所述第二节点分配新的键值, 并将所述第二节点的原始内容更新为 所述第二节点的新内容, 其中, 所述第二节点的新键值与所述第二节点的原始 键值不同; 还用于确定所述第二节点的父节点, 复制所述父节点到所述分布式 Key- Value存储***的緩冲层中, 为所述父节点分配新键值, 将所述父节点的 内容中对具有原始键值的第二节点的指向修改为具有新键值的第二节点的指 向, 其中, 所述父节点的新键值与所述父节点的原始键值不同; 还用于依次复 制所述父节点到所述第一根节点的分支上的其它上级节点到所述分布式 Key- Value存储***的緩冲层中, 直到到达所述根节点, 并为每个上级节点分 配新键值,以及在所述每个上级节点的内容中分别增加对分配新键值的下一级 节点的指向, 其中, 所述每个上级节点的新键值与其对应的原始键值不同; 还 用于在所述第一根节点的内容中增加对所述上级节点的第一级节点的指向,其 中所述第一级节点为所述父节点到所述第一根节点的分支上距离所述根节点 最近的节点;  The processing unit 1002 is configured to copy the first root node in the first storage tree in the storage layer of the distributed Key-Value storage system into the buffer layer of the distributed Key-Value storage system; Deriving the original key value of the second node and the original content into a buffer layer of the distributed Key-Value storage system, allocating a new key value to the second node, and updating the original content of the second node a new content of the second node, where the new key value of the second node is different from the original key value of the second node; and is further used to determine a parent node of the second node, and copy the parent Nodes to the buffer layer of the distributed Key-Value storage system, assigning a new key value to the parent node, and modifying a pointer to the second node having the original key value in the content of the parent node to have a new Pointing to the second node of the key value, wherein the new key value of the parent node is different from the original key value of the parent node; and is further configured to sequentially copy the parent node to the branch of the first root node Other superior nodes to the points In the buffer layer of the Key-Value storage system, until reaching the root node, and assigning a new key value to each of the upper nodes, and adding a new key value to the content of each of the upper nodes respectively Pointing at the first-level node, wherein the new key value of each of the upper-level nodes is different from the original key value thereof; and is further configured to add a first-level node to the upper-level node in the content of the first root node Pointing, wherein the first level node is a node from the parent node to a branch of the first root node that is closest to the root node;
存储单元 1003 , 用于将所述第二节点、所述第二节点的父节点以及所述父 节点的上级节点存储到所述分布式 Key- Value存储***中的存储层中; 还用于 在将所述第二节点、所述第二节点的父节点以及所述父节点的上级节点存储到 所述存储层中之后,将所述第一根节点存储到所述存储层中的所述第一存储树 中。 a storage unit 1003, configured to: use the second node, a parent node of the second node, and the parent The upper node of the node is stored in the storage layer in the distributed Key-Value storage system; and is further configured to store the second node, the parent node of the second node, and the upper node of the parent node to After the storage layer, the first root node is stored in the first storage tree in the storage layer.
在实施例 6提供的服务器中, 所述第二节点的新键值、 父节点的新键值和 每个所述上级节点的新键值都是所述第一存储树中的唯一键值。  In the server provided in Embodiment 6, the new key value of the second node, the new key value of the parent node, and the new key value of each of the superior nodes are unique key values in the first storage tree.
优选的, 所述处理单元还用于在复制所述第一根节点到所述分布式 Key- Value存储***的緩冲层中之后, 为所述复制的第一根节点分配新的版本 号; 则, 所述第二节点的新键值为将所述第二节点的原始键值中的版本号更换 为所述新的版本号后得到的键值,所述父节点的新的键值为将所述父节点的原 始键值中的版本号更换为所述新的版本号后得到的键值,所述每个上级节点的 新的键值为将所述每个上级节点对应的原始键值中的版本号更换为所述新的 版本号后得到的键值。  Preferably, the processing unit is further configured to: after copying the first root node into a buffer layer of the distributed Key-Value storage system, assign a new version number to the copied first root node; Then, the new key value of the second node is a key value obtained by replacing the version number in the original key value of the second node with the new version number, and the new key value of the parent node is Replacing the version number in the original key value of the parent node with the key value obtained after the new version number, and the new key value of each of the upper node is the original key corresponding to each of the upper nodes The version number in the value is replaced with the key value obtained after the new version number.
对应于实施例 3中的一种分布式键值对 Key- Value存储***的数据更新方 法, 如图 11所示, 实施例 7提供了一种服务器, 其包括:  Corresponding to a data update method of a distributed key-value pair Key-Value storage system in Embodiment 3, as shown in FIG. 11, Embodiment 7 provides a server, which includes:
获取单元 1101 , 用于获取第三数据更新请求, 其中, 所述第三数据更新请 求包括需要删除的第三节点;  The obtaining unit 1101 is configured to obtain a third data update request, where the third data update request includes a third node that needs to be deleted;
处理单元 1102 , 用于复制分布式 Key- Value存储***中的存储层中的第一 存储树中的第一根节点到所述分布式 Key- Value存储***的緩冲层中; 还用于 确定所述第三节点的父节点, 复制所述父节点到所述分布式 Key- Value存储系 统的緩冲层中, 为所述父节点分配新键值,删除所述父节点的内容中对所述第 三节点的指向, 其中, 所述父节点的新键值与所述父节点的原始键值不同; 还 用于依次复制所述父节点到所述第一根节点的分支上的其它上级节点到所述 分布式 Key- Value存储***的緩冲层中, 直到到达所述根节点, 并为每个上级 节点分配新键值,以及在所述每个上级节点的内容中分别增加对分配新键值的 下一级节点的指向, 其中, 所述每个上级节点的新键值与其对应的原始键值不 同;还用于在所述第一根节点的内容中增加对所述上级节点的第一级节点的指 向,其中所述第一级节点为所述父节点到所述第一根节点的分支上距离所述根 节点最近的节点; 存储单元 1103 ,用于将所述第三节点的父节点以及所述父节点的上级节点 存储到所述分布式 Key- Value存储***中的存储层中; 还用于在将所述第三节 点的父节点以及所述父节点的上级节点存储到所述分布式 Key- Value存储*** 中的存储层中之后, 将所述第一根节点存储到所述分布式 Key- Value存储*** 中的存储层中的所述第一存储树中。 The processing unit 1102 is configured to copy the first root node in the first storage tree in the storage layer in the distributed Key-Value storage system into the buffer layer of the distributed Key-Value storage system; a parent node of the third node, copying the parent node to a buffer layer of the distributed Key-Value storage system, assigning a new key value to the parent node, and deleting a content of the parent node Pointing at a third node, wherein the new key value of the parent node is different from the original key value of the parent node; and is further configured to sequentially copy the parent node to other superiors on the branch of the first root node Nodes are in a buffer layer of the distributed Key-Value storage system until reaching the root node, and assigning a new key value to each of the upper nodes, and adding a pair of allocations respectively in the content of each of the upper nodes Pointing to a next-level node of the new key value, wherein the new key value of each of the upper-level nodes is different from the original key value thereof; and is further configured to add to the upper-level node in the content of the first root node First-level node Wherein the first stage is the parent node to the first branch of the root node from the root node nearest node; a storage unit 1103, configured to store a parent node of the third node and a superior node of the parent node into a storage layer in the distributed Key-Value storage system; After storing the parent node and the parent node of the parent node in the storage layer in the distributed Key-Value storage system, storing the first root node into the storage in the distributed Key-Value storage system In the first storage tree in the layer.
在实施例 7提供的服务器中, 所述第三节点的父节点的新键值和每个所述 上级节点的新键值都是所述第一存储树中的唯一键值。  In the server provided in Embodiment 7, the new key value of the parent node of the third node and the new key value of each of the superior nodes are unique key values in the first storage tree.
优选的, 所述处理单元还用于在复制所述第一根节点到所述分布式 Key- Value存储***的緩冲层中之后, 为所述复制的第一根节点分配新的版本 号; 则, 所述父节点的新的键值为将所述父节点的原始键值中的版本号更换为 所述新的版本号后得到的键值,所述每个上级节点的新的键值为将所述每个上 级节点对应的原始键值中的版本号更换为所述新的版本号后得到的键值。  Preferably, the processing unit is further configured to: after copying the first root node into a buffer layer of the distributed Key-Value storage system, assign a new version number to the copied first root node; Then, the new key value of the parent node is a key value obtained by replacing the version number in the original key value of the parent node with the new version number, and the new key value of each of the upper node And a key value obtained by replacing the version number in the original key value corresponding to each of the upper nodes with the new version number.
对应于实施例 4中的读取索引节点的方法,如图 12所示, 实施例 8提供了一 种服务器, 其包括:  Corresponding to the method for reading an index node in Embodiment 4, as shown in FIG. 12, Embodiment 8 provides a server, which includes:
第一读取单元 1201 , 用于读取索引中的根节点;  The first reading unit 1201 is configured to read a root node in the index;
获取单元 1202, 用于获取与当前读取的根节点的版本号对应的共享锁; 第二读取单元 1203 , 用于在获取所述共享锁之后, 重新读取所述根节点; 验证单元 1204,用于验证所述共享锁对应的版本号与重新读取后的根节点 的版本号是否一致,若所述共享锁对应的版本号与重新读取后的根节点的版本 号一致, 则对所述重新读取后的根节点加所述共享锁;  The obtaining unit 1202 is configured to acquire a shared lock corresponding to the version number of the currently read root node, and the second reading unit 1203 is configured to re-read the root node after acquiring the shared lock; the verification unit 1204 And verifying that the version number corresponding to the shared lock is consistent with the version number of the root node after re-reading, and if the version number corresponding to the shared lock is consistent with the version number of the root node after re-reading, The root node after re-reading adds the shared lock;
读操作单元 1205 , 用于在对所述重新读取后的根节点加所述共享锁之后, 执行从键值对 Key-Value***的存储层中读取所述根节点下的目标节点的操 作。  a reading operation unit 1205, configured to perform an operation of reading a target node under the root node from a storage layer of a key-value pair Key-Value system after adding the shared lock to the re-read root node .
所述验证单元 1204还用于若所述共享锁对应的版本号与重新读取后的根 节点的版本号不一致,则将所述重新读取后的根节点的版本号作为当前读取的 根节点的版本号,使得所述获取单元获取与当前读取的根节点的版本号相对应 的共享锁。  The verification unit 1204 is further configured to use the version number of the re-read root node as the root of the current read if the version number corresponding to the shared lock does not match the version number of the re-read root node. The version number of the node, such that the obtaining unit acquires a shared lock corresponding to the version number of the currently read root node.
对应于实施例 1中的一种分布式键值对 Key- Value存储***的数据更新方 法, 如图 13所示, 实施例 9提供了一种服务器, 其包括: 输入装置 1301、 输出 装置 1302、緩冲存储器 1303和处理器 1304 (该服务器中的处理器 1304的数量可 以为一个或者多个, 图 13以一个处理器为例)。 本实施例中输入装置 1301、 输 出装置 1302、緩冲存储器 1303和处理器 1304可以通过总线或其他方式连接, 其 中, 图 13以总线连接方式为例。 Corresponding to a data update method of a distributed key-value pair Key-Value storage system in Embodiment 1, as shown in FIG. 13, Embodiment 9 provides a server, which includes: an input device 1301, an output The device 1302, the buffer memory 1303, and the processor 1304 (the number of the processors 1304 in the server may be one or more, and FIG. 13 takes a processor as an example). In this embodiment, the input device 1301, the output device 1302, the buffer memory 1303, and the processor 1304 may be connected by a bus or other means. FIG. 13 is exemplified by a bus connection manner.
在本实施例中, 所述输入装置 1301用于获取第一数据更新请求, 其中, 所 述第一数据更新请求包括需要在分布式 Key- Value存储***中的存储层中的第 一存储树中增加第一节点的键值和内容, 所述第一存储树包括第一根节点; 所述处理器 1304用于执行如下步骤:用于复制所述第一根节点到所述緩冲 存储器 1303中; 还用于确定所述第一节点的父节点, 复制所述父节点到所述緩 冲存储器 1303中, 为所述父节点分配新键值,在所述父节点的内容中增加对所 述第一节点的指向,其中,所述父节点的新键值与所述父节点的原始键值不同; 还用于依次复制所述父节点到所述第一根节点的分支上的其它上级节点到所 述緩冲存储器 1303中, 直到到达所述根节点, 并为每个上级节点分配新键值, 以及在所述每个上级节点的内容中分别增加对分配新键值的下一级节点的指 向, 其中, 所述每个上级节点的新键值与其对应的原始键值不同; 还用于在所 述第一根节点的内容中增加对所述上级节点的第一级节点的指向, 其中, 所述 第一级节点为所述父节点到所述第一根节点的分支上距离所述根节点最近的 节点; 还用于将所述第一节点、所述第一节点的父节点以及所述父节点的上级 节点存储到所述分布式 Key- Value存储***中的存储层中; 以及用于在将所述 第一节点、所述第一节点的父节点以及所述父节点的上级节点存储到所述存储 层之后, 将所述第一根节点存储到所述存储层中的所述第一存储树中。  In this embodiment, the input device 1301 is configured to acquire a first data update request, where the first data update request is included in a first storage tree in a storage layer in a distributed Key-Value storage system. Adding a key value and content of the first node, the first storage tree includes a first root node; the processor 1304 is configured to perform the following steps: copying the first root node into the buffer memory 1303 And a method for determining a parent node of the first node, copying the parent node into the buffer memory 1303, assigning a new key value to the parent node, and adding the Pointing of the first node, wherein the new key value of the parent node is different from the original key value of the parent node; and further for sequentially copying the parent node to other superior nodes on the branch of the first root node Going to the buffer memory 1303 until the root node is reached, and assigning a new key value to each of the upper nodes, and adding a next level to the new key value in the content of each of the upper nodes Pointing, wherein the new key value of each of the upper nodes is different from the original key value thereof; and is further configured to add a pointer to the first level node of the upper node in the content of the first root node The first level node is a node that is closest to the root node on the branch of the first node to the first root node; and is further configured to use the first node, the parent of the first node a node and a superior node of the parent node are stored in a storage layer in the distributed Key-Value storage system; and for using the first node, a parent node of the first node, and the parent node After the upper node is stored in the storage layer, the first root node is stored in the first storage tree in the storage layer.
在实施例 9提供的服务器中, 所述父节点新键值和每个所述上级节点的新 键值都是所述第一存储树中的唯一键值。  In the server provided in Embodiment 9, the parent node new key value and the new key value of each of the superior nodes are unique key values in the first storage tree.
优选的,所述处理器还用于在复制所述第一根节点到所述緩冲存储器 1303 之后, 为复制的第一根节点分配新的版本号, 则所述父节点的新的键值为将所 述父节点的原始键值中的版本号更换为所述新的版本号后得到的键值,所述每 个上级节点的新的键值为将所述每个上级节点对应的原始键值中的版本号更 换为所述新的版本号后得到的键值。  Preferably, the processor is further configured to: after copying the first root node to the buffer memory 1303, assign a new version number to the copied first root node, and then the new key value of the parent node a key value obtained by replacing the version number in the original key value of the parent node with the new version number, the new key value of each of the upper nodes is the original corresponding to each of the upper nodes The version number in the key value is replaced with the key value obtained after the new version number.
对应于实施例 2中的一种分布式键值对 Key- Value存储***的数据更新方 法,如图 13所示,实施例 10提供了一种服务器,其包括:其包括:输入装置 1301、 输出装置 1302、緩冲存储器 1303和处理器 1304 (该服务器中的处理器 1304的数 量可以为一个或者多个, 图 13以一个处理器为例)。本实施例中输入装置 1301、 输出装置 1302、 緩冲存储器 1303和处理器 1304可以通过总线或其他方式连接, 其中, 图 13以总线连接方式为例。 Corresponding to a distributed key-value pair data-update system of the Key-Value storage system in Embodiment 2 As shown in FIG. 13, Embodiment 10 provides a server, which includes: an input device 1301, an output device 1302, a buffer memory 1303, and a processor 1304 (the number of processors 1304 in the server may be For one or more, Figure 13 takes a processor as an example. In this embodiment, the input device 1301, the output device 1302, the buffer memory 1303, and the processor 1304 may be connected by a bus or other means. FIG. 13 is exemplified by a bus connection manner.
在本实施例中, 所述输入装置 1301用于获取第二数据更新请求, 其中, 所 述第二数据更新请求包括需要更新的第二节点的新内容。  In this embodiment, the input device 1301 is configured to obtain a second data update request, where the second data update request includes new content of the second node that needs to be updated.
所述处理器 1304用于执行如下步骤: 用于复制分布式 Key- Value存储*** 的存储层中的第一存储树中的第一根节点到所述緩冲存储器 1303中;还用于复 制所述第二节点的原始键值和原始内容到所述緩冲存储器 1303中,为所述第二 节点分配新的键值,并将所述第二节点的原始内容更新为所述第二节点的新内 容, 其中, 所述第二节点的新键值与所述第二节点的原始键值不同; 还用于确 定所述第二节点的父节点, 复制所述父节点到所述緩冲存储器 1303中, 为所述 父节点分配新键值,将所述父节点的内容中对具有原始键值的第二节点的指向 修改为具有新键值的第二节点的指向, 其中, 所述父节点的新键值与所述父节 点的原始键值不同;还用于依次复制所述父节点到所述第一根节点的分支上的 其它上级节点到所述緩冲存储器 1303中, 直到到达所述根节点, 并为每个上级 节点分配新键值,以及在所述每个上级节点的内容中分别增加对分配新键值的 下一级节点的指向, 其中, 所述每个上级节点的新键值与其对应的原始键值不 同;还用于在所述第一根节点的内容中增加对所述上级节点的第一级节点的指 向,其中所述第一级节点为所述父节点到所述第一根节点的分支上距离所述根 节点最近的节点;还用于将所述第二节点、所述第二节点的父节点以及所述父 节点的上级节点存储到所述分布式 Key- Value存储***中的存储层中; 还用于 在将所述第二节点、所述第二节点的父节点以及所述父节点的上级节点存储到 所述存储层中之后,将所述第一根节点存储到所述存储层中的所述第一存储树 中。  The processor 1304 is configured to: reproduce the first root node in the first storage tree in the storage layer of the distributed Key-Value storage system into the buffer memory 1303; Deriving the original key value of the second node and the original content into the buffer memory 1303, assigning a new key value to the second node, and updating the original content of the second node to the second node a new content, where the new key value of the second node is different from the original key value of the second node; and is further configured to determine a parent node of the second node, and copy the parent node to the buffer memory In 1303, a new key value is allocated to the parent node, and a pointer to the second node having the original key value in the content of the parent node is modified to a pointer of the second node having a new key value, where the parent The new key value of the node is different from the original key value of the parent node; and is also used to sequentially copy the parent node to other superior nodes on the branch of the first root node into the buffer memory 1303 until reaching Root section And assigning a new key value to each of the upper nodes, and respectively adding a pointer to the next level node assigning the new key value in the content of each of the upper nodes, wherein the new key value of each of the upper nodes Different from the original key value corresponding thereto; further configured to add a pointer to the first level node of the upper node in the content of the first root node, where the first level node is the parent node to the a node on a branch of the first node that is closest to the root node; and is further configured to store the second node, a parent node of the second node, and a superior node of the parent node to the distributed key- The storage layer in the value storage system is further configured to: after storing the second node, the parent node of the second node, and the upper node of the parent node into the storage layer, The root node is stored in the first storage tree in the storage tier.
在实施例 10提供的服务器中, 所述第二节点的新键值、 父节点的新键值和 每个所述上级节点的新键值都是所述第一存储树中的唯一键值。  In the server provided in Embodiment 10, the new key value of the second node, the new key value of the parent node, and the new key value of each of the superior nodes are unique key values in the first storage tree.
优选的, 所述处理器 1304还用于在复制所述第一根节点到所述分布式 Key- Value存储***的緩冲层中之后, 为所述复制的第一根节点分配新的版本 号; 则, 所述第二节点的新键值为将所述第二节点的原始键值中的版本号更换 为所述新的版本号后得到的键值,所述父节点的新的键值为将所述父节点的原 始键值中的版本号更换为所述新的版本号后得到的键值,所述每个上级节点的 新的键值为将所述每个上级节点对应的原始键值中的版本号更换为所述新的 版本号后得到的键值。 Preferably, the processor 1304 is further configured to: copy the first root node to the distributed After the key-value is stored in the buffer layer of the system, the first root node of the copy is assigned a new version number; then, the new key value of the second node is the original key value of the second node. The version number is replaced with the key value obtained after the new version number, and the new key value of the parent node is obtained by replacing the version number in the original key value of the parent node with the new version number. The key value of each of the upper nodes is a key value obtained by replacing the version number in the original key value corresponding to each of the upper nodes with the new version number.
对应于实施例 3中的一种分布式键值对 Key- Value存储***的数据更新方 法,如图 13所示,实施例 11提供了一种服务器,其包括:其包括:输入装置 1301、 输出装置 1302、緩冲存储器 1303和处理器 1304 (该服务器中的处理器 1304的数 量可以为一个或者多个, 图 13以一个处理器为例)。本实施例中输入装置 1301、 输出装置 1302、 緩冲存储器 1303和处理器 1304可以通过总线或其他方式连接, 其中, 图 13以总线连接方式为例。  Corresponding to a data update method of a distributed key-value pair Key-Value storage system in Embodiment 3, as shown in FIG. 13, Embodiment 11 provides a server, which includes: an input device 1301, an output The device 1302, the buffer memory 1303, and the processor 1304 (the number of the processors 1304 in the server may be one or more, and FIG. 13 takes a processor as an example). In this embodiment, the input device 1301, the output device 1302, the buffer memory 1303, and the processor 1304 may be connected by a bus or other means, wherein FIG. 13 takes a bus connection as an example.
在本实施例中, 所述输入装置 1301用于获取第三数据更新请求, 其中, 所 述第三数据更新请求包括需要删除的第三节点。  In this embodiment, the input device 1301 is configured to acquire a third data update request, where the third data update request includes a third node that needs to be deleted.
所述处理器 1304用于执行如下步骤: 用于复制分布式 Key- Value存储*** 中的存储层中的第一存储树中的第一根节点到所述緩冲存储器 1303中;还用于 确定所述第三节点的父节点, 复制所述父节点到所述緩冲存储器 1303中, 为所 述父节点分配新键值,删除所述父节点的内容中对所述第三节点的指向,其中, 所述父节点的新键值与所述父节点的原始键值不同;还用于依次复制所述父节 点到所述第一根节点的分支上的其它上级节点到所述緩冲存储器 1303中,直到 到达所述根节点, 并为每个上级节点分配新键值, 以及在所述每个上级节点的 内容中分别增加对分配新键值的下一级节点的指向, 其中, 所述每个上级节点 的新键值与其对应的原始键值不同;还用于在所述第一根节点的内容中增加对 所述上级节点的第一级节点的指向,其中所述第一级节点为所述父节点到所述 第一根节点的分支上距离所述根节点最近的节点;还用于将所述第三节点的父 节点以及所述父节点的上级节点存储到所述分布式 Key- Value存储***中的存 储层中;还用于在将所述第三节点的父节点以及所述父节点的上级节点存储到 所述分布式 Key- Value存储***中的存储层中之后, 将所述第一根节点存储到 所述分布式 Key- Value存储***中的存储层中的所述第一存储树中。 在实施例 11提供的一种服务器中 ,所述第三节点的父节点的新键值和每个 所述上级节点的新键值都是所述第一存储树中的唯一键值。 The processor 1304 is configured to: reproduce the first root node in the first storage tree in the storage layer in the distributed Key-Value storage system into the buffer memory 1303; a parent node of the third node, copying the parent node into the buffer memory 1303, assigning a new key value to the parent node, and deleting a pointer to the third node in the content of the parent node, The new key value of the parent node is different from the original key value of the parent node; and is further used to sequentially copy the parent node to other upper-level nodes on the branch of the first root node to the buffer memory. In 1303, until the root node is reached, and a new key value is assigned to each upper node, and a pointer to a next-level node that assigns a new key value is respectively added in the content of each of the upper-level nodes, where The new key value of each upper node is different from the original key value thereof; and is further configured to add a pointer to the first level node of the upper node in the content of the first root node, where the first level Node is the parent section Pointing to a node on the branch of the first root node that is closest to the root node; and also for storing the parent node of the third node and the superior node of the parent node to the distributed Key-Value store a storage layer in the system; and further configured to: after storing the parent node of the third node and the upper node of the parent node into a storage layer in the distributed Key-Value storage system, A node is stored in the first storage tree in a storage tier in the distributed Key-Value storage system. In a server provided in Embodiment 11, the new key value of the parent node of the third node and the new key value of each of the superior nodes are unique key values in the first storage tree.
优选的, 所述处理器 1304还用于在复制所述第一根节点到所述分布式 Key- Value存储***的緩冲层中之后, 为所述复制的第一根节点分配新的版本 号; 则, 所述父节点的新的键值为将所述父节点的原始键值中的版本号更换为 所述新的版本号后得到的键值,所述每个上级节点的新的键值为将所述每个上 级节点对应的原始键值中的版本号更换为所述新的版本号后得到的键值。  Preferably, the processor 1304 is further configured to: after copying the first root node into a buffer layer of the distributed Key-Value storage system, assign a new version number to the copied first root node. Then, the new key value of the parent node is a key value obtained by replacing the version number in the original key value of the parent node with the new version number, and the new key of each upper node The value is a key value obtained by replacing the version number in the original key value corresponding to each of the upper nodes with the new version number.
对应于实施例 4中的读取索引节点的方法, 如图 13所示, 实施例 12提供了 一种服务器,其包括:其包括:输入装置 1301、输出装置 1302、緩冲存储器 1303 和处理器 1304 (该服务器中的处理器 1304的数量可以为一个或者多个, 图 13 以一个处理器为例)。 本实施例中输入装置 1301、 输出装置 1302、 緩冲存储器 1303和处理器 1304可以通过总线或其他方式连接, 其中, 图 13以总线连接方式 为例。  Corresponding to the method of reading the index node in Embodiment 4, as shown in FIG. 13, Embodiment 12 provides a server including: an input device 1301, an output device 1302, a buffer memory 1303, and a processor. 1304 (The number of processors 1304 in the server may be one or more, and FIG. 13 takes a processor as an example). In this embodiment, the input device 1301, the output device 1302, the buffer memory 1303, and the processor 1304 may be connected by a bus or other means, wherein FIG. 13 is a bus connection manner.
在本实施例中, 所述处理器 1304用于执行如下步骤: 读取索引中的根节点 到所述緩冲存储器 1303;  In this embodiment, the processor 1304 is configured to perform the following steps: reading a root node in the index to the buffer memory 1303;
获取与当前读取的根节点的版本号对应的共享锁;  Obtaining a shared lock corresponding to the version number of the currently read root node;
在获取所述共享锁之后, 重新读取所述根节点;  Retrieving the root node after acquiring the shared lock;
验证所述共享锁对应的版本号与重新读取后的根节点的版本号是否一致, 若所述共享锁对应的版本号与重新读取后的根节点的版本号一致,则对所述重 新读取后的根节点加所述共享锁;  Verifying that the version number corresponding to the shared lock is consistent with the version number of the root node after re-reading, and if the version number corresponding to the shared lock is consistent with the version number of the root node after re-reading, The root node after reading adds the shared lock;
在对所述重新读取后的根节点加所述共享锁之后, 执行从键值对 Key-Value***的存储层中读取所述根节点下的目标节点的操作。  After the shared lock is added to the re-read root node, an operation of reading the target node under the root node from the storage layer of the Key-Value system is performed.
优选的, 所述处理器 1304还用于执行: 若所述共享锁对应的版本号与重新 读取后的根节点的版本号不一致,则将所述重新读取后的根节点的版本号作为 当前读取的根节点的版本号,返回所述获取与当前读取的根节点的版本号相对 应的共享锁的步骤。  Preferably, the processor 1304 is further configured to: if the version number corresponding to the shared lock does not match the version number of the root node after re-reading, use the version number of the re-read root node as The version number of the currently read root node, returning the step of obtaining a shared lock corresponding to the version number of the currently read root node.
图 14为本发明的服务器的又一实施例的结构组成示意图。如图 14可知, 具 体实现中, 本发明实施例的服务器 1405还可由处理器 1401、存储器 1402、 总线 1403和通信接口 1404等物理模块构成, 其中, 所述存储器 1402用于存储计算机 执行指令, 所述处理器 1401与所述存储器 1402通过所述总线连接, 当所述服务 器 1405运行时,所述处理器 1401执行所述存储器 1402存储的所述计算机执行指 令, 并通过所述通信接口 1404与所述集群管理设备外部的设备进行通信, 以使 所述服务器执行本发明各实施例所述的数据更新方法。 Figure 14 is a block diagram showing the structure of still another embodiment of the server of the present invention. As shown in FIG. 14, in a specific implementation, the server 1405 of the embodiment of the present invention may also be configured by a physical module such as a processor 1401, a memory 1402, a bus 1403, and a communication interface 1404, where the memory 1402 is used to store a computer. Executing instructions, the processor 1401 is connected to the memory 1402 via the bus, and when the server 1405 is running, the processor 1401 executes the computer execution instructions stored by the memory 1402, and through the communication The interface 1404 communicates with devices external to the cluster management device to cause the server to perform the data update method described in various embodiments of the present invention.
具体实现中, 本发明还提供一种计算机存储介质, 其中, 该计算机存储介 质可存储有程序,给程序执行时可包括本发明提供的基于虚拟组网的交换机配 置方法的各实施例中的部分或全部步骤。 所述的存储介质可为磁碟、 光盘、 只 读存储记忆体( Read-Only Memory, ROM )或随机存储记忆体( Random Access Memory, RAM )等。  In a specific implementation, the present invention further provides a computer storage medium, wherein the computer storage medium may store a program, and when the program is executed, may include a part of each embodiment of the virtual network-based switch configuration method provided by the present invention. Or all steps. The storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).
以上对本发明实施例所提供的一种分布式键值对 Key- Value存储***的数 据更新方法、 一种读取索引节点的方法, 以及相应的服务器进行了详细介绍, 说明只是用于帮助理解本发明的方法及其核心思想; 同时,对于本领域的一般 技术人员,依据本发明的思想,在具体实施方式及应用范围上均会有改变之处, 综上所述, 本说明书内容不应理解为对本发明的限制。  The data update method of the distributed key value to the Key-Value storage system, the method for reading the index node, and the corresponding server are described in detail in the foregoing embodiments of the present invention, and the description is only used to help understand the present The method of the invention and its core idea; at the same time, for the person skilled in the art, according to the idea of the present invention, there will be changes in the specific embodiment and the scope of application. In summary, the content of the specification should not be understood. To limit the invention.

Claims

权 利 要 求 Rights request
1、 一种分布式键值对 Key- Value存储***的数据更新方法, 其特征在于, 所述分布式 Key- Value存储***中的存储层包括第一存储树, 所述第一存储树 包括第一根节点, 所述方法包括: 1. A data update method in a distributed key-value storage system, characterized in that the storage layer in the distributed key-value storage system includes a first storage tree, and the first storage tree includes a first storage tree. A node, the method includes:
获取第一数据更新请求, 其中, 所述第一数据更新请求包括需要在所述第 一存储树中增加第一节点的键值和内容; Obtain a first data update request, wherein the first data update request includes the key value and content of a first node that needs to be added to the first storage tree;
复制所述第一根节点到所述分布式 Key- Value存储***的緩冲层中; 确定所述第一节点在所述第一存储树中的父节点,复制所述父节点到所述 分布式 Key- Value存储***的緩冲层中, 为所述父节点分配新键值, 在所述父 节点的内容中增加对所述第一节点的指向, 其中, 所述父节点的新键值与所述 父节点的原始键值不同; Copy the first root node to the buffer layer of the distributed Key-Value storage system; determine the parent node of the first node in the first storage tree, and copy the parent node to the distribution In the buffer layer of the Key-Value storage system, allocate a new key value to the parent node, and add a pointer to the first node in the content of the parent node, where, the new key value of the parent node Different from the original key value of the parent node;
依次复制所述父节点到所述第一根节点的分支上的其它上级节点到所述 分布式 Key- Value存储***的緩冲层中, 直到到达所述根节点, 并为每个上级 节点分配新键值,以及在所述每个上级节点的内容中分别增加对分配新键值的 下一级节点的指向, 其中, 所述每个上级节点的新键值与其对应的原始键值不 同; Copy other upper-level nodes on the branch from the parent node to the first root node in sequence to the buffer layer of the distributed Key-Value storage system until the root node is reached, and allocate to each upper-level node New key values, and adding a pointer to the next-level node to which the new key value is allocated in the content of each upper-level node, wherein the new key value of each upper-level node is different from its corresponding original key value;
在所述第一根节点的内容中增加对所述上级节点的第一级节点的指向,其 中,所述第一级节点为所述父节点到所述第一根节点的分支上距离所述根节点 最近的节点; Add a pointer to the first-level node of the upper-level node in the content of the first root node, where the first-level node is the distance on the branch from the parent node to the first root node. The node closest to the root node;
将所述第一节点、所述第一节点的父节点以及所述父节点的上级节点存储 到所述分布式 Key- Value存储***中的存储层中; Store the first node, the parent node of the first node, and the upper-level node of the parent node in the storage layer in the distributed Key-Value storage system;
将所述第一根节点存储到所述分布式 Key- Value存储***中的存储层中的 所述第一存储树中。 The first root node is stored in the first storage tree in the storage layer in the distributed Key-Value storage system.
2、 如权利要求 1所述的方法, 其特征在于, 所述父节点的新键值和每个所 述上级节点的新键值都是所述第一存储树中的唯一键值。 2. The method of claim 1, wherein the new key value of the parent node and the new key value of each upper-level node are unique key values in the first storage tree.
3、 如权利要求 2所述的方法, 其特征在于, 在复制所述第一根节点到所述 分布式 Key- Value存储***的緩冲层中之后, 还包括: 3. The method according to claim 2, characterized in that, after copying the first root node to the buffer layer of the distributed Key-Value storage system, it further includes:
为复制的第一根节点分配新的版本号; Assign a new version number to the first copied root node;
则,所述父节点的新的键值为将所述父节点的原始键值中的版本号更换为 所述新的版本号后得到的键值,所述每个上级节点的新的键值为将所述每个上 级节点对应的原始键值中的版本号更换为所述新的版本号后得到的键值。 Then, the new key value of the parent node is to replace the version number in the original key value of the parent node with The key value obtained after the new version number. The new key value of each upper-level node is obtained by replacing the version number in the original key value corresponding to each upper-level node with the new version number. key value.
4、 一种分布式键值对 Key- Value存储***的数据更新方法, 其特征在于, 所述分布式 Key- Value存储***中的存储层包括第一存储树, 所述第一存储树 包括第一根节点, 所述方法包括: 4. A data update method in a distributed key-value storage system, characterized in that the storage layer in the distributed key-value storage system includes a first storage tree, and the first storage tree includes a first storage tree. A node, the method includes:
获取第二数据更新请求, 其中, 所述第二数据更新请求包括需要更新的第 二节点的新内容; Obtain a second data update request, wherein the second data update request includes new content of the second node that needs to be updated;
复制所述第一根节点到所述分布式 Key- Value存储***的緩冲层中; 复制所述第二节点的原始键值和原始内容到所述分布式 Key- Value存储系 统的緩冲层中, 为所述第二节点分配新的键值, 并将所述第二节点的原始内容 更新为所述第二节点的新内容, 其中, 所述第二节点的新键值与所述第二节点 的原始键值不同; Copy the first root node to the buffer layer of the distributed Key-Value storage system; Copy the original key value and original content of the second node to the buffer layer of the distributed Key-Value storage system , assign a new key value to the second node, and update the original content of the second node to the new content of the second node, wherein the new key value of the second node is the same as the first The original key values of the two nodes are different;
确定所述第二节点的父节点, 复制所述父节点到所述分布式 Key- Value存 储***的緩冲层中, 为所述父节点分配新键值, 将所述父节点的内容中对具有 原始键值的第二节点的指向修改为具有新键值的第二节点的指向, 其中, 所述 父节点的新键值与所述父节点的原始键值不同; Determine the parent node of the second node, copy the parent node to the buffer layer of the distributed Key-Value storage system, assign a new key value to the parent node, and match the content of the parent node to the buffer layer of the distributed Key-Value storage system. The pointing of the second node with the original key value is modified to the pointing of the second node with the new key value, wherein the new key value of the parent node is different from the original key value of the parent node;
依次复制所述父节点到所述第一根节点的分支上的其它上级节点到所述 分布式 Key- Value存储***的緩冲层中, 直到到达所述根节点, 并为每个上级 节点分配新键值,以及在所述每个上级节点的内容中分别增加对分配新键值的 下一级节点的指向, 其中, 所述每个上级节点的新键值与其对应的原始键值不 同; Copy other upper-level nodes on the branch from the parent node to the first root node in sequence to the buffer layer of the distributed Key-Value storage system until the root node is reached, and allocate to each upper-level node New key values, and adding a pointer to the next-level node to which the new key value is allocated in the content of each upper-level node, wherein the new key value of each upper-level node is different from its corresponding original key value;
在所述第一根节点的内容中增加对所述上级节点的第一级节点的指向,其 中所述第一级节点为所述父节点到所述第一根节点的分支上距离所述根节点 最近的节点; Add a pointer to the first-level node of the upper-level node in the content of the first root node, where the first-level node is the distance from the root to the branch from the parent node to the first root node. The node closest to the node;
将所述第二节点、所述第二节点的父节点以及所述父节点的上级节点存储 到所述分布式 Key- Value存储***中的存储层中; Store the second node, the parent node of the second node, and the superior node of the parent node in the storage layer in the distributed Key-Value storage system;
将所述第一根节点存储到所述分布式 Key- Value存储***中的存储层中的 所述第一存储树中。 The first root node is stored in the first storage tree in the storage layer in the distributed Key-Value storage system.
5、 如权利要求 4所述的方法, 其特征在于, 所述第二节点的新键值、 父节 点的新键值和每个所述上级节点的新键值都是所述第一存储树中的唯一键值。 5. The method according to claim 4, characterized in that: the new key value of the second node, the parent node The new key value of the point and the new key value of each upper-level node are unique key values in the first storage tree.
6、 如权利要求 5所述的方法, 其特征在于, 在复制所述第一根节点到所述 分布式 Key- Value存储***的緩冲层中之后, 还包括: 6. The method according to claim 5, characterized in that, after copying the first root node to the buffer layer of the distributed Key-Value storage system, it further includes:
为所述复制的第一根节点分配新的版本号; Assign a new version number to the copied first root node;
则,所述第二节点的新键值为将所述第二节点的原始键值中的版本号更换 为所述新的版本号后得到的键值,所述父节点的新的键值为将所述父节点的原 始键值中的版本号更换为所述新的版本号后得到的键值,所述每个上级节点的 新的键值为将所述每个上级节点对应的原始键值中的版本号更换为所述新的 版本号后得到的键值。 Then, the new key value of the second node is the key value obtained by replacing the version number in the original key value of the second node with the new version number, and the new key value of the parent node is The version number in the original key value of the parent node is replaced with the key value obtained by the new version number. The new key value of each upper-level node is the original key corresponding to each upper-level node. The key value obtained after replacing the version number in the value with the new version number.
7、 一种分布式键值对 Key- Value存储***的数据更新方法, 其特征在于, 所述分布式 Key- Value存储***中的存储层包括第一存储树, 所述第一存储树 包括第一根节点, 所述方法包括: 7. A data update method in a distributed key-value storage system, characterized in that the storage layer in the distributed key-value storage system includes a first storage tree, and the first storage tree includes a first storage tree. A node, the method includes:
获取第三数据更新请求, 其中, 所述第三数据更新请求包括需要删除的第 三节点; Obtain a third data update request, wherein the third data update request includes the third node that needs to be deleted;
复制所述第一根节点到所述分布式 Key- Value存储***的緩冲层中; 确定所述第三节点的父节点, 复制所述父节点到所述分布式 Key- Value存 储***的緩冲层中, 为所述父节点分配新键值,删除所述父节点的内容中对所 述第三节点的指向,其中,所述父节点的新键值与所述父节点的原始键值不同; 依次复制所述父节点到所述第一根节点的分支上的其它上级节点到所述 分布式 Key- Value存储***的緩冲层中, 直到到达所述根节点, 并为每个上级 节点分配新键值,以及在所述每个上级节点的内容中分别增加对分配新键值的 下一级节点的指向, 其中, 所述每个上级节点的新键值与其对应的原始键值不 同; Copy the first root node to the buffer layer of the distributed Key-Value storage system; determine the parent node of the third node, and copy the parent node to the buffer layer of the distributed Key-Value storage system. In the flush layer, assign a new key value to the parent node, and delete the pointer to the third node in the content of the parent node, where the new key value of the parent node is the same as the original key value of the parent node. Different; sequentially copy the parent node to other upper-level nodes on the branch of the first root node to the buffer layer of the distributed Key-Value storage system until the root node is reached, and for each upper-level node The node allocates a new key value, and adds a pointer to the next-level node to which the new key value is allocated in the content of each upper-level node, where the new key value of each upper-level node and its corresponding original key value different;
在所述第一根节点的内容中增加对所述上级节点的第一级节点的指向,其 中所述第一级节点为所述父节点到所述第一根节点的分支上距离所述根节点 最近的节点; Add a pointer to the first-level node of the upper-level node in the content of the first root node, where the first-level node is the distance from the root to the branch from the parent node to the first root node. The node closest to the node;
将所述第三节点的父节点以及所述父节点的上级节点存储到所述分布式 Key- Value存储***中的存储层中; Store the parent node of the third node and the superior node of the parent node in the storage layer in the distributed Key-Value storage system;
将所述第一根节点存储到所述分布式 Key- Value存储***中的存储层中的 所述第一存储树中。 Store the first root node in the storage layer in the distributed Key-Value storage system in the first storage tree.
8、 如权利要求 7所述的方法, 其特征在于, 所述第三节点的父节点的新键 值和每个所述上级节点的新键值都是所述第一存储树中的唯一键值。 8. The method of claim 7, wherein the new key value of the parent node of the third node and the new key value of each upper-level node are unique keys in the first storage tree. value.
9、 如权利要求 8所述的方法, 其特征在于, 在复制所述第一根节点到所述 分布式 Key- Value存储***的緩冲层中之后, 还包括: 9. The method according to claim 8, characterized in that, after copying the first root node to the buffer layer of the distributed Key-Value storage system, it further includes:
为所述复制的第一根节点分配新的版本号; Assign a new version number to the copied first root node;
则,所述父节点的新的键值为将所述父节点的原始键值中的版本号更换为 所述新的版本号后得到的键值,所述每个上级节点的新的键值为将所述每个上 级节点对应的原始键值中的版本号更换为所述新的版本号后得到的键值。 Then, the new key value of the parent node is the key value obtained by replacing the version number in the original key value of the parent node with the new version number. The new key value of each superior node It is the key value obtained by replacing the version number in the original key value corresponding to each upper-level node with the new version number.
10、 一种读索引节点的方法, 其特征在于, 包括: 10. A method for reading index nodes, which is characterized by including:
读取索引中的根节点; Read the root node in the index;
获取与当前读取的根节点的版本号对应的共享锁; Obtain the shared lock corresponding to the version number of the currently read root node;
在获取所述共享锁之后, 重新读取所述根节点; After acquiring the shared lock, re-read the root node;
验证所述共享锁对应的版本号与重新读取后的根节点的版本号是否一致, 若所述共享锁对应的版本号与重新读取后的根节点的版本号一致,则对所述重 新读取后的根节点加所述共享锁; Verify whether the version number corresponding to the shared lock is consistent with the version number of the re-read root node. If the version number corresponding to the shared lock is consistent with the version number of the re-read root node, then the re-read version number is consistent. The shared lock is added to the read root node;
在对所述重新读取后的根节点加所述共享锁之后, 执行从键值对 Key-Value***的存储层中读取所述根节点下的目标节点的操作。 After adding the shared lock to the re-read root node, an operation of reading the target node under the root node from the storage layer of the Key-Value system is performed.
11、 根据权利要求 10所述的读索引节点的方法, 其特征在于, 还包括: 若 所述共享锁对应的版本号与重新读取后的根节点的版本号不一致,则将所述重 新读取后的根节点的版本号作为当前读取的根节点的版本号,返回所述获取与 当前读取的根节点的版本号相对应的共享锁的步骤。 11. The method for reading an index node according to claim 10, further comprising: if the version number corresponding to the shared lock is inconsistent with the version number of the re-read root node, re-reading the index node. The fetched version number of the root node is used as the version number of the currently read root node, and the step of obtaining the shared lock corresponding to the currently read version number of the root node is returned.
12、 一种服务器, 其特征在于, 包括: 12. A server, characterized in that it includes:
获取单元, 用于获取第一数据更新请求, 其中, 所述第一数据更新请求包 括需要在分布式 Key- Value存储***中的存储层中的第一存储树中增加第一节 点的键值和内容, 所述第一存储树包括第一根节点; The acquisition unit is used to obtain the first data update request, wherein the first data update request includes the key value and the first node that need to be added to the first storage tree in the storage layer in the distributed Key-Value storage system. Content, the first storage tree includes a first root node;
处理单元, 用于复制所述第一根节点到所述分布式 Key- Value存储***的 緩冲层中; 还用于确定所述第一节点的父节点, 复制所述父节点到所述分布式 Key- Value存储***的緩冲层中, 为所述父节点分配新键值, 在所述父节点的 内容中增加对所述第一节点的指向, 其中, 所述父节点的新键值与所述父节点 的原始键值不同;还用于依次复制所述父节点到所述第一根节点的分支上的其 它上级节点到所述分布式 Key- Value存储***的緩冲层中, 直到到达所述根节 点, 并为每个上级节点分配新键值, 以及在所述每个上级节点的内容中分别增 加对分配新键值的下一级节点的指向, 其中, 所述每个上级节点的新键值与其 对应的原始键值不同;还用于在所述第一根节点的内容中增加对所述上级节点 的第一级节点的指向, 其中, 所述第一级节点为所述父节点到所述第一根节点 的分支上距离所述根节点最近的节点; A processing unit, configured to copy the first root node to the buffer layer of the distributed Key-Value storage system; also configured to determine the parent node of the first node, and copy the parent node to the distribution In the buffer layer of the Key-Value storage system, a new key value is assigned to the parent node, and in the parent node Add a pointer to the first node in the content, where the new key value of the parent node is different from the original key value of the parent node; it is also used to copy the parent node to the first root node in sequence. Other upper-level nodes on the branch go to the buffer layer of the distributed Key-Value storage system until the root node is reached, and a new key value is assigned to each upper-level node, as well as the content of each upper-level node. respectively add points to the next-level nodes to which new key values are allocated, where the new key value of each upper-level node is different from its corresponding original key value; it is also used to add to the content of the first root node Pointing to the first-level node of the upper-level node, wherein the first-level node is the node closest to the root node on the branch from the parent node to the first root node;
存储单元, 用于将所述第一节点、所述第一节点的父节点以及所述父节点 的上级节点存储到所述分布式 Key- Value存储***中的存储层中; 以及用于在 将所述第一节点、所述第一节点的父节点以及所述父节点的上级节点存储到所 述存储层之后, 将所述第一根节点存储到所述存储层中的所述第一存储树中。 A storage unit configured to store the first node, the parent node of the first node, and the upper-level node of the parent node into a storage layer in the distributed Key-Value storage system; and for storing the After the first node, the parent node of the first node, and the upper-level node of the parent node are stored in the storage layer, the first root node is stored in the first storage in the storage layer. In the tree.
13、 根据权利要求 12所述的服务器, 其特征在于, 13. The server according to claim 12, characterized in that,
所述父节点新键值和每个所述上级节点的新键值都是所述第一存储树中 的唯一键值。 The new key value of the parent node and the new key value of each upper-level node are unique key values in the first storage tree.
14、 根据权利要求 13所述的服务器, 其特征在于, 14. The server according to claim 13, characterized in that,
所述处理单元还用于在复制所述第一根节点到所述分布式 Key- Value存储 ***的緩冲层中之后, 为复制的第一根节点分配新的版本号, 则所述父节点的 新的键值为将所述父节点的原始键值中的版本号更换为所述新的版本号后得 到的键值,所述每个上级节点的新的键值为将所述每个上级节点对应的原始键 值中的版本号更换为所述新的版本号后得到的键值。 The processing unit is also configured to allocate a new version number to the copied first root node after copying the first root node to the buffer layer of the distributed Key-Value storage system, then the parent node The new key value is the key value obtained by replacing the version number in the original key value of the parent node with the new version number, and the new key value of each superior node is the key value obtained by replacing each of the parent node's original key value with the new version number. The version number in the original key value corresponding to the upper-level node is replaced with the key value obtained by the new version number.
15、 一种服务器, 其特征在于, 包括: 15. A server, characterized by including:
获取单元, 用于获取第二数据更新请求, 其中, 所述第二数据更新请求包 括需要更新的第二节点的新内容; An acquisition unit configured to acquire a second data update request, wherein the second data update request includes new content of the second node that needs to be updated;
处理单元, 用于复制分布式 Key- Value存储***的存储层中的第一存储树 中的第一根节点到所述分布式 Key- Value存储***的緩冲层中; 还用于复制所 述第二节点的原始键值和原始内容到所述分布式 Key- Value存储***的緩冲层 中, 为所述第二节点分配新的键值, 并将所述第二节点的原始内容更新为所述 第二节点的新内容, 其中, 所述第二节点的新键值与所述第二节点的原始键值 不同; 还用于确定所述第二节点的父节点, 复制所述父节点到所述分布式 Key- Value存储***的緩冲层中, 为所述父节点分配新键值, 将所述父节点的 内容中对具有原始键值的第二节点的指向修改为具有新键值的第二节点的指 向, 其中, 所述父节点的新键值与所述父节点的原始键值不同; 还用于依次复 制所述父节点到所述第一根节点的分支上的其它上级节点到所述分布式 Key- Value存储***的緩冲层中, 直到到达所述根节点, 并为每个上级节点分 配新键值,以及在所述每个上级节点的内容中分别增加对分配新键值的下一级 节点的指向, 其中, 所述每个上级节点的新键值与其对应的原始键值不同; 还 用于在所述第一根节点的内容中增加对所述上级节点的第一级节点的指向,其 中所述第一级节点为所述父节点到所述第一根节点的分支上距离所述根节点 最近的节点; A processing unit, configured to copy the first root node in the first storage tree in the storage layer of the distributed Key-Value storage system to the buffer layer of the distributed Key-Value storage system; also used to copy the Put the original key value and original content of the second node into the buffer layer of the distributed Key-Value storage system, allocate a new key value to the second node, and update the original content of the second node to The new content of the second node, wherein the new key value of the second node and the original key value of the second node Different; It is also used to determine the parent node of the second node, copy the parent node to the buffer layer of the distributed Key-Value storage system, assign a new key value to the parent node, and copy the parent node to the buffer layer of the distributed Key-Value storage system. In the content of the node, the pointing to the second node with the original key value is modified to the pointing to the second node with the new key value, wherein the new key value of the parent node is different from the original key value of the parent node; and For sequentially copying other upper-level nodes on the branch from the parent node to the first root node to the buffer layer of the distributed Key-Value storage system until the root node is reached, and for each upper-level node The node allocates a new key value, and adds a pointer to the next-level node to which the new key value is allocated in the content of each upper-level node, where the new key value of each upper-level node and its corresponding original key value Different; It is also used to add a pointer to the first-level node of the upper-level node in the content of the first root node, where the first-level node is a branch from the parent node to the first root node. The node closest to the root node;
存储单元, 用于将所述第二节点、所述第二节点的父节点以及所述父节点 的上级节点存储到所述分布式 Key- Value存储***中的存储层中; 还用于在将 所述第二节点、所述第二节点的父节点以及所述父节点的上级节点存储到所述 存储层中之后, 将所述第一根节点存储到所述存储层中的所述第一存储树中。 A storage unit configured to store the second node, the parent node of the second node, and the upper-level node of the parent node into a storage layer in the distributed Key-Value storage system; After the second node, the parent node of the second node, and the upper-level node of the parent node are stored in the storage layer, the first root node is stored in the first node in the storage layer. stored in the tree.
16、根据权利要求 15所述的服务器,其特征在于,所述第二节点的新键值、 父节点的新键值和每个所述上级节点的新键值都是所述第一存储树中的唯一 键值。 16. The server according to claim 15, characterized in that the new key value of the second node, the new key value of the parent node and the new key value of each upper-level node are all the first storage tree The unique key value in .
17、 根据权利要求 16所述的服务器, 其特征在于, 17. The server according to claim 16, characterized in that,
所述处理单元还用于在复制所述第一根节点到所述分布式 Key- Value存储 ***的緩冲层中之后, 为所述复制的第一根节点分配新的版本号; 则, 所述第 二节点的新键值为将所述第二节点的原始键值中的版本号更换为所述新的版 本号后得到的键值,所述父节点的新的键值为将所述父节点的原始键值中的版 本号更换为所述新的版本号后得到的键值 ,所述每个上级节点的新的键值为将 所述每个上级节点对应的原始键值中的版本号更换为所述新的版本号后得到 的键值。 The processing unit is also configured to allocate a new version number to the copied first root node after copying the first root node to the buffer layer of the distributed Key-Value storage system; then, The new key value of the second node is the key value obtained by replacing the version number in the original key value of the second node with the new version number, and the new key value of the parent node is the key value obtained by replacing the version number of the original key value of the second node with the new version number. The version number in the original key value of the parent node is replaced with the key value obtained by the new version number. The new key value of each upper-level node is the original key value corresponding to each upper-level node. The key value obtained after the version number is replaced with the new version number.
18、 一种服务器, 其特征在于, 包括: 18. A server, characterized by including:
获取单元, 用于获取第三数据更新请求, 其中, 所述第三数据更新请求包 括需要删除的第三节点; 处理单元, 用于复制分布式 Key- Value存储***中的存储层中的第一存储 树中的第一根节点到所述分布式 Key- Value存储***的緩冲层中; 还用于确定 所述第三节点的父节点, 复制所述父节点到所述分布式 Key- Value存储***的 緩冲层中, 为所述父节点分配新键值,删除所述父节点的内容中对所述第三节 点的指向, 其中, 所述父节点的新键值与所述父节点的原始键值不同; 还用于 依次复制所述父节点到所述第一根节点的分支上的其它上级节点到所述分布 式 Key- Value存储***的緩冲层中, 直到到达所述根节点, 并为每个上级节点 分配新键值,以及在所述每个上级节点的内容中分别增加对分配新键值的下一 级节点的指向, 其中, 所述每个上级节点的新键值与其对应的原始键值不同; 还用于在所述第一根节点的内容中增加对所述上级节点的第一级节点的指向, 其中所述第一级节点为所述父节点到所述第一根节点的分支上距离所述根节 点最近的节点; An acquisition unit configured to acquire a third data update request, wherein the third data update request includes a third node that needs to be deleted; A processing unit, configured to copy the first root node in the first storage tree in the storage layer in the distributed Key-Value storage system to the buffer layer of the distributed Key-Value storage system; and also used to determine the The parent node of the third node, copies the parent node to the buffer layer of the distributed Key-Value storage system, allocates a new key value to the parent node, and deletes the content of the parent node. Pointing to the third node, where the new key value of the parent node is different from the original key value of the parent node; also used to copy the parent node to other superior nodes on the branch of the first root node in sequence to the buffer layer of the distributed Key-Value storage system until the root node is reached, and a new key value is assigned to each upper-level node, and a new key value is added to the content of each upper-level node. Pointing to the next-level node of the key value, where the new key value of each upper-level node is different from its corresponding original key value; and is also used to add a reference to the upper-level node in the content of the first root node. Pointing to the first-level node, where the first-level node is the node closest to the root node on the branch from the parent node to the first root node;
存储单元,用于将所述第三节点的父节点以及所述父节点的上级节点存储 到所述分布式 Key- Value存储***中的存储层中; 还用于在将所述第三节点的 父节点以及所述父节点的上级节点存储到所述分布式 Key- Value存储***中的 存储层之后, 将所述第一根节点存储到所述分布式 Key- Value存储***中的存 储层中的所述第一存储树中。 A storage unit configured to store the parent node of the third node and the superior node of the parent node into the storage layer in the distributed Key-Value storage system; and also used to store the third node's parent node in the storage layer. After the parent node and the upper-level node of the parent node are stored in the storage layer in the distributed Key-Value storage system, the first root node is stored in the storage layer in the distributed Key-Value storage system. in the first storage tree.
19、 根据权利要求 18所述的服务器, 其特征在于, 19. The server according to claim 18, characterized in that,
所述第三节点的父节点的新键值和每个所述上级节点的新键值都是所述 第一存储树中的唯一键值。 The new key value of the parent node of the third node and the new key value of each upper-level node are unique key values in the first storage tree.
20、 根据权利要求 19所述的服务器, 其特征在于, 20. The server according to claim 19, characterized in that,
所述处理单元还用于在复制所述第一根节点到所述分布式 Key- Value存储 ***的緩冲层中之后, 为所述复制的第一根节点分配新的版本号; 则, 所述父 节点的新的键值为将所述父节点的原始键值中的版本号更换为所述新的版本 号后得到的键值 ,所述每个上级节点的新的键值为将所述每个上级节点对应的 原始键值中的版本号更换为所述新的版本号后得到的键值。 The processing unit is also configured to allocate a new version number to the copied first root node after copying the first root node to the buffer layer of the distributed Key-Value storage system; then, The new key value of the parent node is the key value obtained by replacing the version number in the original key value of the parent node with the new version number, and the new key value of each superior node is the key value obtained by replacing the version number in the original key value of the parent node with the new version number. The version number in the original key value corresponding to each of the upper-level nodes is replaced with the key value obtained by the new version number.
21、 一种服务器, 其特征在于, 包括: 21. A server, characterized by including:
第一读取单元, 用于读取索引中的根节点; The first reading unit is used to read the root node in the index;
获取单元, 用于获取与当前读取的根节点的版本号对应的共享锁; 第二读取单元, 用于在获取所述共享锁之后, 重新读取所述根节点; 验证单元,用于验证所述共享锁对应的版本号与重新读取后的根节点的版 本号是否一致,若所述共享锁对应的版本号与重新读取后的根节点的版本号一 致, 则对所述重新读取后的根节点加所述共享锁; Acquisition unit, used to obtain the shared lock corresponding to the version number of the currently read root node; The second reading unit is used to re-read the root node after acquiring the shared lock; the verification unit is used to verify whether the version number corresponding to the shared lock and the version number of the re-read root node are Consistent, if the version number corresponding to the shared lock is consistent with the version number of the re-read root node, then the shared lock is added to the re-read root node;
读操作单元, 用于在对所述重新读取后的根节点加所述共享锁之后,执行 从键值对 Key-Value***的存储层中读取所述根节点下的目标节点的操作。 The read operation unit is configured to perform an operation of reading the target node under the root node from the storage layer of the Key-Value system after adding the shared lock to the re-read root node.
22、 根据权利要求 21所述的服务器, 其特征在于, 所述验证单元还用于若 所述共享锁对应的版本号与重新读取后的根节点的版本号不一致,则将所述重 新读取后的根节点的版本号作为当前读取的根节点的版本号,使得所述获取单 元获取与当前读取的根节点的版本号相对应的共享锁。 22. The server according to claim 21, characterized in that, the verification unit is further configured to: if the version number corresponding to the shared lock is inconsistent with the version number of the re-read root node, the re-read The fetched version number of the root node is used as the version number of the currently read root node, so that the acquisition unit acquires the shared lock corresponding to the version number of the currently read root node.
23、 一种服务器, 其特征在于, 包括处理器、 存储器、 总线和通信接口; 所述存储器用于存储计算机执行指令, 所述处理器与所述存储器通过所述总 线连接, 当所述服务器运行时, 所述处理器执行所述存储器存储的所述计算 机执行指令, 并通过所述通信接口与所述服务器部的设备进行通信, 以使所 述服务器执行如权利要求 1 -9中任一所述的分布式键值对 Key- Value存储*** 的数据更新方法。 23. A server, characterized in that it includes a processor, a memory, a bus and a communication interface; the memory is used to store computer execution instructions, and the processor and the memory are connected through the bus. When the server is running When The data update method of the distributed key-value storage system described above.
24、 一种计算机可读介质, 其特征在于, 包括计算机执行指令, 以供计算 机的处理器执行所述计算机执行指令时, 所述计算机执行如权利要求 1-9中任 一所述的分布式键值对 Key- Value存储***的数据更新方法。 24. A computer-readable medium, characterized in that it includes computer execution instructions, so that when the computer processor executes the computer execution instructions, the computer executes the distributed method according to any one of claims 1-9. Data update method of Key-Value storage system.
PCT/CN2013/072840 2013-03-19 2013-03-19 Data update method and server for distributed storage system WO2014146240A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2013/072840 WO2014146240A1 (en) 2013-03-19 2013-03-19 Data update method and server for distributed storage system
CN201380000766.3A CN103518364B (en) 2013-03-19 2013-03-19 The data-updating method of distributed memory system and server

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2013/072840 WO2014146240A1 (en) 2013-03-19 2013-03-19 Data update method and server for distributed storage system

Publications (1)

Publication Number Publication Date
WO2014146240A1 true WO2014146240A1 (en) 2014-09-25

Family

ID=49899392

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2013/072840 WO2014146240A1 (en) 2013-03-19 2013-03-19 Data update method and server for distributed storage system

Country Status (2)

Country Link
CN (1) CN103518364B (en)
WO (1) WO2014146240A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2020098819A3 (en) * 2019-12-05 2020-10-15 Alipay (Hangzhou) Information Technology Co., Ltd. Performing map iterations in a blockchain-based system
US10985919B2 (en) 2019-12-05 2021-04-20 Alipay (Hangzhou) Information Technology Co., Ltd. Performing map iterations in a blockchain-based system

Families Citing this family (23)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104461384B (en) * 2014-11-28 2017-11-24 华为技术有限公司 A kind of method for writing data and storage device
CN105721527B (en) * 2014-12-04 2019-03-01 金蝶软件(中国)有限公司 A kind of data processing method and server
CN104794196B (en) * 2015-04-21 2018-07-31 浙江大学 A kind of acquisition of tree structure data and update method
CN105208105B (en) * 2015-08-26 2019-03-08 北京奇虎科技有限公司 Index updating method and device
CN106534049B (en) * 2015-09-11 2020-10-20 腾讯科技(深圳)有限公司 Data issuing method based on server, client, server and system
CN106557278A (en) * 2015-09-30 2017-04-05 腾讯科技(深圳)有限公司 A kind of method of data cached persistence
CN105391755B (en) * 2015-09-30 2018-10-19 华为技术有限公司 Data processing method, apparatus and system in a kind of distributed system
CN106708608B (en) * 2015-11-16 2020-08-11 阿里巴巴集团控股有限公司 Distributed lock service method, acquisition method and corresponding device
US10637923B2 (en) * 2016-05-25 2020-04-28 Cisco Technology, Inc. Congestion aware load balancing for distributed storage
CN107800738B (en) * 2016-09-05 2021-03-05 华为数字技术(苏州)有限公司 Data updating method and device
CN106354565B (en) * 2016-09-21 2019-08-20 努比亚技术有限公司 A kind of distributed lock client and control method
CN106844676B (en) * 2017-01-24 2020-07-07 北京奇虎科技有限公司 Data storage method and device
CN108694219B (en) * 2017-04-12 2023-05-19 腾讯科技(深圳)有限公司 Data processing method and device
CN107294828B (en) * 2017-06-15 2020-06-26 广州天源信息科技股份有限公司 Cross-region distributed site interaction and data synchronization method
CN107463512B (en) * 2017-06-26 2020-11-13 上海高顿教育培训有限公司 Data updating method of distributed high-speed storage system
CN108446376B (en) * 2018-03-16 2022-04-08 众安信息技术服务有限公司 Data storage method and device
CN108809838B (en) * 2018-06-28 2020-11-27 北京顺丰同城科技有限公司 Service discovery processing method and device based on tree structure
CN109033278B (en) * 2018-07-11 2020-09-08 江苏通付盾科技有限公司 Data processing method and device, electronic equipment and computer storage medium
CN109657114B (en) * 2018-08-21 2023-11-03 国家计算机网络与信息安全管理中心 Method for extracting webpage semi-structured data
CN110162525B (en) * 2019-04-17 2023-09-26 平安科技(深圳)有限公司 B+ tree-based read-write conflict resolution method, device and storage medium
CN111538864B (en) * 2020-03-25 2023-03-31 新华三技术有限公司合肥分公司 Method and device for reducing Buildrun consumption
CN112579602B (en) * 2020-12-22 2023-06-09 杭州趣链科技有限公司 Multi-version data storage method, device, computer equipment and storage medium
CN113704255A (en) * 2021-08-04 2021-11-26 深圳市蜜蜂互联网络科技有限公司 Data insertion method and device, and data verification method and device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1522409A (en) * 2001-06-09 2004-08-18 存储交易株式会社 Cache-conscious concurrency control scheme for database systems
CN101339538A (en) * 2007-07-04 2009-01-07 三星电子株式会社 Data tree storage methods, systems and computer program products using page structure
CN102843396A (en) * 2011-06-22 2012-12-26 中兴通讯股份有限公司 Data writing and reading method and device in distributed caching system
US20130041904A1 (en) * 2011-08-10 2013-02-14 Goetz Graefe Computer indexes with multiple representations

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7293028B2 (en) * 2001-06-08 2007-11-06 Sap Ag Cache-conscious concurrency control scheme for database systems
CN102495838B (en) * 2011-11-03 2014-09-17 华为数字技术(成都)有限公司 Data processing method and data processing device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1522409A (en) * 2001-06-09 2004-08-18 存储交易株式会社 Cache-conscious concurrency control scheme for database systems
CN101339538A (en) * 2007-07-04 2009-01-07 三星电子株式会社 Data tree storage methods, systems and computer program products using page structure
CN102843396A (en) * 2011-06-22 2012-12-26 中兴通讯股份有限公司 Data writing and reading method and device in distributed caching system
US20130041904A1 (en) * 2011-08-10 2013-02-14 Goetz Graefe Computer indexes with multiple representations

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2020098819A3 (en) * 2019-12-05 2020-10-15 Alipay (Hangzhou) Information Technology Co., Ltd. Performing map iterations in a blockchain-based system
US10985919B2 (en) 2019-12-05 2021-04-20 Alipay (Hangzhou) Information Technology Co., Ltd. Performing map iterations in a blockchain-based system
US11108555B2 (en) 2019-12-05 2021-08-31 Alipay (Hangzhou) Information Technology Co., Ltd. Performing map iterations in a blockchain-based system
US11251969B2 (en) 2019-12-05 2022-02-15 Alipay (Hangzhou) Information Technology Co., Ltd. Performing map iterations in a blockchain-based system

Also Published As

Publication number Publication date
CN103518364B (en) 2016-03-09
CN103518364A (en) 2014-01-15

Similar Documents

Publication Publication Date Title
WO2014146240A1 (en) Data update method and server for distributed storage system
US10896102B2 (en) Implementing secure communication in a distributed computing system
US10417186B2 (en) File migration method and apparatus, and storage device
JP7090606B2 (en) Formation and operation of test data in a database system
US10983955B2 (en) Data unit cloning in memory-based file systems
US10375167B2 (en) Low latency RDMA-based distributed storage
US10534547B2 (en) Consistent transition from asynchronous to synchronous replication in hash-based storage systems
US10642694B2 (en) Monitoring containers in a distributed computing system
US9952783B2 (en) Data processing method and apparatus, and shared storage device
US9558194B1 (en) Scalable object store
KR101573965B1 (en) Atomic multiple modification of data in a distributed storage system
US10402378B2 (en) Method and system for executing an executable file
JP2008524724A (en) How to perform parallel data migration in a clustered storage environment
CN110750507B (en) Persistent client caching method and system under global namespace facing DFS
US20180165299A1 (en) Data transformation for object storage
US10515228B2 (en) Commit and rollback of data streams provided by partially trusted entities
US10558373B1 (en) Scalable index store
WO2022175080A1 (en) Cache indexing using data addresses based on data fingerprints
US10031668B2 (en) Determining status of a host operation without accessing the host in a shared storage environment
US11256434B2 (en) Data de-duplication
WO2016127807A1 (en) Method for writing multiple copies into storage device, and storage device
US20200342065A1 (en) Replicating user created snapshots
US11068500B1 (en) Remote snapshot access in a replication setup
WO2024103714A1 (en) Data processing method and system, apparatus, and related device
US20230273728A1 (en) Storage control apparatus and method

Legal Events

Date Code Title Description
WWE Wipo information: entry into national phase

Ref document number: 201380000766.3

Country of ref document: CN

121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 13878880

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 13878880

Country of ref document: EP

Kind code of ref document: A1