Method, electronic device and computer program product for processing key value data
By storing the key-value data in the storage system in the main storage tree or the secondary storage tree according to the storage level of the key-value data and establishing associations between the memories, the low efficiency of key-value data processing and poor user experience in the prior art are solved. The problem is to achieve more efficient data processing and better user experience.
Patent Information
- Application Number
- CN202310945414.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-28
- Publication Date
- 2025-02-14
AI Technical Summary
When processing key-value data, existing storage systems have problems such as high I/O costs, waste of computing resources, deterioration in performance and poor user experience, especially when data with different access frequencies need to be stored in different memory.
By obtaining key-value data and its corresponding storage levels, storing data in the main storage tree or secondary storage tree in response to different storage levels, establishing the association between key data in different memories, and realizing the implementation of all key-value data in the storage system Quick positioning.
It improves the efficiency of data processing in the storage system, reduces I/O costs and waste of computing resources, improves user experience, and reduces the overall performance impact of the storage system.
Smart Images

Figure CN119440380A_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present disclosure relate to the field of storage systems, and in particular to a method, an electronic device, and a computer program product for processing key-value data. Background Art
[0002] As users' demand for data storage increases, more and more memories are included in the storage system to meet user needs. At least one user of the storage system can process data, such as key-value data (KV), via the storage system. For example, the at least one user can store (or write), read, delete, or edit the key-value data. These data may be stored in different memories in the storage system, which may be memories of the same type or different types. Summary of the invention
[0003] Embodiments of the present disclosure provide a method, an electronic device, and a computer program product for processing key-value data.
[0004] According to a first aspect of the present disclosure, a method for processing key-value data is provided, comprising: acquiring key-value data and a storage level corresponding to the key-value data, the key-value data comprising key data and value data, the storage level indicating a storage performance level of a memory in a storage system; in response to the storage level being a first level, storing the key-value data in a primary storage tree in a first memory in the storage system; and in response to the storage level being a second level, storing the key data in the primary storage tree and storing the key-value data in a secondary storage tree in a second memory in the storage system, the first level being higher than the second level.
[0005] According to a second aspect of the present disclosure, an electronic device is provided, comprising: at least one processor; and a memory, coupled to the at least one processor and having instructions stored thereon, wherein the instructions, when executed by the at least one processor, cause the electronic device to perform actions, the actions comprising: obtaining key-value data and a storage level corresponding to the key-value data, the key-value data comprising key data and value data, the storage level indicating a storage performance level of a memory in a storage system; in response to the storage level being a first level, storing the key-value data in a primary storage tree in a first memory in the storage system; and in response to the storage level being a second level, storing the key data in the primary storage tree, and storing the key-value data in a secondary storage tree in a second memory in the storage system, the first level being higher than the second level.
[0006] According to a third aspect of the present disclosure, there is provided a computer program product, which is tangibly stored on a non-volatile computer-readable medium and comprises machine-executable instructions, which when executed cause a machine to perform the steps of the method in the first aspect of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0007] The above and other objects, features and advantages of the present disclosure will become more apparent through a more detailed description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, wherein like reference numerals generally represent like components throughout the exemplary embodiments of the present disclosure.
[0008] Figure 1 A schematic diagram of an application environment of a storage system according to an embodiment of the present disclosure is illustrated.
[0009] Figure 2A A schematic block diagram of storing key-value data in a storage system according to an embodiment of the present disclosure is illustrated.
[0010] Figure 2B A schematic block diagram of storing key-value data in a storage system according to another embodiment of the present disclosure is illustrated.
[0011] Figure 3A A schematic block diagram of operating key-value data in a storage system according to an embodiment of the present disclosure is illustrated.
[0012] Figure 3B A schematic block diagram of reading key-value data in a storage system according to an embodiment of the present disclosure is illustrated.
[0013] Figure 3C A schematic block diagram of reading key-value data in a storage system according to another embodiment of the present disclosure is illustrated.
[0014] Figure 4 A schematic block diagram of querying key-value data in a storage system according to an embodiment of the present disclosure is illustrated.
[0015] Figure 5 A flowchart of a method for processing key-value data according to an embodiment of the present disclosure is illustrated.
[0016] Figure 6 A block diagram of an electronic device for processing key-value data according to an embodiment of the present disclosure is illustrated.
[0017] Figure 7 A schematic block diagram of one example of an example device suitable for implementing embodiments of the present disclosure is illustrated.
[0018] In the various drawings, the same or corresponding reference numerals represent the same or corresponding parts. DETAILED DESCRIPTION
[0019] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0020] In the description of the embodiments of the present disclosure, the term "including" and similar terms should be understood as open inclusion, that is, "including but not limited to". The term "based on" should be understood as "based at least in part on". The term "one embodiment" or "the embodiment" should be understood as "at least one embodiment". The terms "first", "second", etc. may refer to different or the same objects. Other explicit and implicit definitions may also be included below.
[0021] In a storage system with multiple different memories, different key-value data may be stored in different memories. For example, frequently used key-value data (i.e., hot data) may be stored in a memory with higher storage performance (e.g., NVMe memory), while less frequently used key-value data (i.e., cold data) may be stored in a memory with lower storage performance (e.g., HDD memory). Key-value data is a data pair KV consisting of key data K and value data V. Storage performance may refer to the storage (i.e., write (PUT)), deletion, read (GET), editing, query or other access performance of the memory. A memory with higher storage performance can process data efficiently, resulting in a higher user experience, but the cost is also higher. A memory with lower storage performance processes data less efficiently and at a lower cost.
[0022] The above storage method for key-value data is to balance the user experience and the storage system cost. However, the memories in the storage system are independent of each other, each memory has its own independent storage logic, and the user who stores the key-value data in the storage system may be different from the user who accesses the key-value data stored in the storage system. Therefore, the following situation may exist: the user who accesses the key-value data does not know in which memory the key-value data he needs to access is stored, so the user may issue a request to retrieve the required key-value data from all memories in the storage system via the user terminal, so that each memory in the storage system needs to perform a retrieval operation, which will result in a large amount of I / O cost, waste the computing resources of the storage system, degrade the performance of the storage system, and make it difficult to obtain a good user experience. In particular, when the key-value data that the user expects to access is a column of key-value data (which includes multiple key-value data), the above problem will be further exacerbated, because the memory with a slower access speed will further increase the time required for retrieval.
[0023] In addition, in order to improve the processing efficiency of key-value data, all key-value data can be stored in a memory with higher storage performance. However, this will cause "cold data" to unnecessarily occupy more storage resources with high storage performance, increasing the cost of the storage system.
[0024] In an embodiment of the present disclosure, at least a part of the above-mentioned disadvantages can be overcome by providing a method, an electronic device and a computer program product for processing key-value data. The method includes obtaining key-value data and a storage level corresponding to the key-value data, the key-value data including key data and value data, and the storage level indicates the storage performance level of the memory in the storage system. The method also includes storing the key-value data in a main storage tree in a first memory in the storage system in response to the storage level being a first level. The method also includes storing the key data in the main storage tree and storing the key-value data in a secondary storage tree in a second memory in the storage system in response to the storage level being a second level, the first level being higher than the second level. According to the method, associations can be established between different memories in the storage system through key data, so that all key-value data in the storage system can be quickly located through memories with higher storage performance, thereby improving the efficiency of the storage system in processing data.
[0025] Figure 1 A schematic diagram of an application environment 1000 of a storage system according to an embodiment of the present disclosure is illustrated. Figure 1The illustrated application environment 1000 shows two user terminals 1100 (but may include one or more user terminals 1100) and a storage system 1200. Each user terminal 1000 may interact with the storage system 1200 to transmit commands or data (e.g., key value data KV, or key data K, etc.). The storage system 1200 may include a plurality of memories 1210, 1220-1, ..., 1220-N, where N is an integer greater than or equal to 1. As an example, the memory 1210 may represent a memory with the highest storage performance, while the memory 1220 (which includes the memory 1220-1, ..., 1220-N) may represent a memory with a lower storage performance than the memory 1210. For example, the memory 1210 may be an NVMe memory, the memory 1220 may be an HDD memory or other type of memory, and the memory 1220-1, ..., 1220-N may be the same type or different types of memory with different storage performance.
[0026] As an example, the storage system 1200 can process the key-value data according to the processing command received from any user terminal 1100, for example, store, delete, read, edit, or query. In addition, in some embodiments, in addition to receiving the processing command, the storage system 1200 can also receive the key-value data KV to be stored or edited (for example, in the case of storing key-value data, or editing key-value data, etc.), or receive the key data K (for example, in the case of reading key-value data, deleting key-value data, or querying key-value data, etc.). Figures 2A to 4 An example of a method for processing key-value data according to an embodiment of the present disclosure is described.
[0027] Figure 2A A schematic block diagram of storing key-value data KV in a storage system 1200 according to an embodiment of the present disclosure is illustrated. Figure 2A Specifically shows Figure 1 An example of a storage system 1200 of FIG. The storage system 1200 includes a reference Figure 1 The memories 1210, 1220-1, ..., 1220-N are described. In the following, for the convenience of description, as an example, the memory 1210 with the highest storage performance is referred to as the first memory, and the memory 1220 with a storage performance lower than the storage performance of the memory 1210 is referred to as the second memory. As an example, one or more memories 1220-1, ..., 1220-N included in the second memory 1220 are referred to as second sub-memories.
[0028] The first memory 1210 and the second sub-memory 1220-1, ..., 1220-N each have a storage tree for storing key-value data KV, for example, each storage tree is a B+ tree. A B+ tree is a binary search tree that allows a node to have two child nodes, a copy of the key data is stored on an internal node, and the key-value data (or a data pair consisting of key data and other data) is stored on a leaf node, and the leaf node includes a pointer to the next leaf node to speed up sequential access. In this article, for ease of description, as an example, the storage tree T1 in the first memory 1210 is referred to as the main storage tree, and the storage tree T2-1, ..., TN in the second sub-memory 1220-1, ..., 1220-N is referred to as an auxiliary storage tree.
[0029] In some embodiments, the storage system 1200 may also have a write ahead log WAL (write ahead log) file 1230 and an in-memory table 1240. As an example, the WAL file 1230 is append-only, and can only write data, such as key value data KV or key data K, sequentially. The key value data KV or key data K received from the user terminal 1100 needs to be written (i.e., stored) to the WAL file 1230 first, and then can be used to access the memory of the storage system (e.g., store, delete, or edit, etc.). The WAL file 1230 can be used for fault or transaction recovery, that is, it can be used to replay the unprocessed key value data in the case of power failure of the storage system to continue the processing of the key value data. After completing the processing of all key value data, the data stored in the WAL file can be deleted to free up storage space. As an example, the WAL file can be stored in a predetermined non-volatile memory in the storage system, for example, on a disk. As an example, when the WAL file stores the received key-value data KV or key data K in the order in which it is received, the memory table 1240 may store the same key-value data KV or key data K, but store them in the order of the key data K to increase the processing speed. Then, the sorted key-value data KV or key data K stored in the memory table 1240 may be used for accessing (e.g., storing, deleting, or editing, etc.) the memory 1210 or 1220. As an example, the memory table 1240 may be stored in a predetermined volatile memory in the storage system, such as a memory.
[0030] For example, in some embodiments, when the storage system 1200 receives key-value data KV that needs to be stored in the storage system 1200 from the user terminal 1100, the key-value data KV may be stored in the WAL file 1230 and the memory table 1240, and then the key-value data KV may be dumped from the memory table 1240 to the primary storage tree T1 of the first memory 1210, or to the auxiliary storage trees T2-1, ..., TN in the second memory 1220. In addition, in some embodiments, in order to save the I / O cost of the storage system 1200, the key-value data may be dumped in batches to the primary storage tree T1 or the auxiliary storage trees T2-1, ..., TN when the dumping condition is met (for example, the number of key-value data stored in the memory table reaches a predetermined threshold).
[0031] The following takes dumping key-value data in batches as an example to illustrate the storage processing of key-value data. For example, in some embodiments, the storage system 1200 may sequentially receive multiple key-value data KV and their corresponding storage levels from any user terminal 1100, and the storage level may indicate the memory 1210 or 1220-1, ..., 1220-N where the corresponding key-value data KV specified by the user via the user terminal 1100 should be stored. The storage system 1200 stores the received key-value data KV in the WAL file 1230 in the order of receipt, and stores it in the memory table 1230 in the order of key data.
[0032] In some embodiments, after receiving a predetermined threshold number of key-value data KV and its corresponding storage level, the storage system 1200 (or an associated processor) may determine whether the storage level of the key-value data KV is the highest storage level. In the following, for ease of description, as an example, the highest storage level is referred to as the first level, and the non-highest storage level is referred to as the second level. As an example, the first level corresponds to the first memory 1210, and the second level corresponds to the second memory 1220. The second level may include at least one second sub-level, each second sub-level corresponding to a second sub-memory 1220-1, ..., 1220-N.
[0033] Afterwards, as an example, the storage system 1200 (or an associated processor) may determine the key value data KV corresponding to the first level as the first key value data, and determine the key value data KV corresponding to the second level as the second key value data. For example, the key value data KV shown by the blank box in FIG. 2 may represent the first key value data, and the key value data KV shown by the oblique line shaded box may represent the second key value data. In some embodiments, for the second key value data, the storage system 1200 (or an associated processor) may generate indication data R according to its second sub-level (i.e., the received storage level), and the indication data R may indicate that the second key value data should be stored in the second sub-memory 1220-1, ..., 1220-N. Here, the size of the indication data R generated by the received storage level may be smaller than the size of the received storage level data, thereby saving storage space. For example, the received storage level may be a more complex statement, and the generated indication data may be the physical address of the auxiliary storage tree or the second sub-memory, or may be only the number ID (e.g., integer) of the auxiliary storage tree, so as to further save storage space and improve storage efficiency. It should be understood that in other embodiments, the received storage level data may be directly used as the indication data R.
[0034] Afterwards, in some embodiments, the dump from the memory table 1240 to the primary storage tree T1 and the dump from the memory table 1240 to the auxiliary storage trees T2-1, ..., TN may be performed simultaneously or non-simultaneously, and the dumped key value data KV may be immediately deleted from the memory table 1240. As an example, in the process of dumping to the primary storage tree T1, the value data V in the second key value data (shown by the diagonal shaded box) in the memory table 1240 may be replaced with the indication data R, thereby generating the associated data pair KR, and then the first key value data KV and the generated associated data pair KR may be dumped to the leaf node of the primary storage tree T1 in the order of the key data, as shown in the primary storage tree T1 of FIG2. In addition, as an example, in the process of dumping to the auxiliary storage trees T2-1, ..., TN, the second key value data corresponding to different second sub-levels may be dumped to different second sub-memories 1220-1, ..., 1220-N. For example, the first key-value data KV shown by the oblique line shaded box in the memory table 1240 of FIG. 2 may be stored in the auxiliary storage tree T2-1 (located in the second sub-memory 1220-1), and the indication data R in the first associated data pair KR in the main storage tree T1 may indicate the second sub-memory 1220-1 where the auxiliary storage tree T2-1 is located. The second key-value data KV shown by the oblique line shaded box in the memory table 1240 of FIG. 2 may be stored in the auxiliary storage tree between the auxiliary storage trees T2-1 and T2-N (located in the second sub-memory between the second sub-memory 1220-1 to 1220-N), and the indication data R in the second associated data pair KR in the main storage tree T1 may indicate the second sub-memory where the auxiliary storage tree is located. The third key value data KV shown by the diagonal shaded box in the memory table 1240 of Figure 2 can be stored in the auxiliary storage tree T2-N (located in the second sub-memory 1220-N), and the indication data R in the third associated data pair KR in the main storage tree T1 can indicate the second sub-memory 1220-N where the auxiliary storage tree T2-N is located; and so on.
[0035] In some embodiments, after the dump to the primary storage tree T1 of the first storage and the auxiliary storage trees T2-1, ..., TN of all the second sub-storages is completed, the key-value data in the WAL file 1230 may be deleted. In addition, in some embodiments, if the dump is not completed and the dump is interrupted due to a power failure of the storage system 1200, the WAL file 1230 may be used to replay the key-value data that has not been dumped, so as to dump the key-value data that has not been dumped into the primary storage tree T1 or the corresponding auxiliary storage trees T2-1, ..., TN by storing the key-value data that has not been dumped into the memory table 1240.
[0036] Through the above storage method, the key data K of all key-value data KV in the storage system can be stored in the first memory 1210 with higher storage performance, so that an association can be established between the memory 1210 with higher storage performance and the memory 1220 with lower performance through the associated data set pair KR. Therefore, by only accessing the first memory 1210 (or also accessing the memory table 1240 (in the case of key-value data that has not been dumped yet)), it is possible to know the memory 1210, 1220-1, ..., 1220-N where the corresponding key-value data KR is stored, thereby preventing the second memory 1220 with lower performance from affecting the overall performance of the storage system 1200, and greatly improving the efficiency of processing key-value data. In addition, since the storage space occupied by the key data K and the indicator data R is very small, it will not affect the storage cost of the storage system 1200.
[0037] In addition, since the processing speeds of the first memory 1210 and the second memory 1220 are different, in order to further improve the efficiency of processing key value data, the main storage tree T1 and each auxiliary storage tree T2-1, ..., TN can also be dumped independently. For example, in some embodiments, an independent sub-WAL file and sub-memory table can be established for each auxiliary storage tree. For example, when the proportion of the second key value data is less than a predetermined proportion threshold (for example, 50%, 40%, 30%, 20%, 10% or any other proportion value), a sub-WAL file and a sub-memory table of each auxiliary storage tree can be established. Figure 2B One such example is shown.
[0038] Figure 2B A schematic block diagram of storing key-value data in a storage system 1200 according to another embodiment of the present disclosure is illustrated. Figure 2B The sub-WAL file 1230-1 and the sub-memory table 1240-1 established for the second sub-storage 1220-1 are only schematically shown. It should be understood that similar sub-WAL files and sub-memory tables can be established for other second sub-storages. In some embodiments, the sub-WAL file 1230-1 and the sub-memory table 1240-1 may include the second key value data copied from the memory table 1240 and to be stored in the corresponding second sub-storage 1220-1. In some embodiments, by referring to the above Figure 2A In a similar manner, the second key value data in the sub-memory table 1240-1 may be dumped into the auxiliary storage tree T2-1 of the second sub-memory 1220-1.
[0039] In this case, as an example, the memory table 1240 is only used for dumping the main storage tree T1. In some embodiments, after the dump to the main storage tree T1 is completed, the key-value data in the WAL file 1230 can be deleted. After the dump to the corresponding second sub-memory 1240-1 is completed, the key-value data in the sub-WAL file 1230-1 can be deleted; and so on. In some embodiments, if the dump to the first memory or any second sub-memory is not completed and the dump is interrupted due to power failure of the storage system 1200, the WAL file 1230 and the sub-WAL file (e.g., 1230-1) can be used to replay the key-value data that has not been dumped, so as to dump it into the main storage tree or the corresponding auxiliary storage tree by storing the key-value data that has not been dumped in the memory table 1240 or the corresponding sub-memory table (e.g., 1240-1).
[0040] In this way, after completing the dump of any memory, the corresponding WAL file (or sub-WAL file) can be deleted, thereby improving the storage space utilization of the storage system. In addition, when the power is off, only the data in the corresponding WAL file (or sub-WAL file) needs to be played back, and there is no need to play back the WAL file with all the key-value data, thereby significantly reducing the amount of read data, further improving the data processing efficiency. In addition, since the proportion of the second key-value data is small, the establishment of the sub-WAL file and the sub-memory table will not significantly affect the write-in amount of the storage system.
[0041] FIG. 3 illustrates a schematic block diagram of operating key-value data in a storage system 1200 according to an embodiment of the present disclosure.
[0042] FIG3 shows a key-value data KV such as Figure 2A or Figure 2B As shown in the figure, after being stored in the storage system 1200, the stored key-value data KV is subjected to a deletion operation and an editing operation. For the deletion operation, as an example, the storage system 1200 may receive key data K (such as the key data K shown by the oblique line shaded box in FIG. 3 ) from any user terminal 1100, store the received key data K in the WAL file 1230 in the order of reception, and store the received key data K in the memory table 1240 in the order of key data. For the editing operation, as an example, the storage system 1200 may receive key data KV (such as the key data KV shown by the dotted shaded box in FIG. 3 ) from any user terminal 1100, store the received key data KV in the WAL file 1230 in the order of reception, and store the received key data KV in the memory table 1240 in the order of key data. Then, the storage location of the key-value data to be operated in the storage system 1200 may be determined according to the key data K.
[0043] As an example, the received key data K may be compared with the key data K in the key-value data KV that has not been dumped in the memory table 1240. If the key data K that is consistent with the received key data K exists in the memory table 1240, it can be determined that the key-value data KV required by the user is located in the memory table 1240, and then the key-value data KV in the memory table 1240 can be processed accordingly, such as deleted, edited, etc. As an example, if the key data K that is consistent with the received key data K does not exist in the memory table 1240, the received key data K may be compared with the key data K stored in the main storage tree T1 in the memory 1210, and it can be determined whether the key data K in the main storage tree T1 that is consistent with the received key data K is the key data in the key-value data KV or the key data in the associated data pair KR. If it is key data in the key-value data KV, then the key-value data can be processed accordingly (e.g., deleted, edited, etc.); if it is key data in the associated data pair KR, then the memory 1220-1, ..., 1220-N where the required key-value data is stored can be determined by the indication data R, and then the key-value data in the memory can be processed accordingly (e.g., deleted, edited, etc.). It should be understood that in the presence of Figure 2B In the case of the sub-WAL file and sub-memory table shown in the figure, the above operations can also be performed on the sub-memory table.
[0044] In addition, for the read operation, a process similar to the above can also be performed, the difference being that the storage system 1200 can receive key data K from any user terminal 1100, but does not store the key data K in the WLA file 1230 and the memory table 1240. Instead, the received key data K is directly compared with the key data in the memory table 1240 (or the sub-memory table), or at least one item in the main storage tree T1, to locate the key value data to be read.
[0045] Through the above method, the required key-value data can be located only by accessing the first memory (or also accessing the memory table or sub-memory table), thereby greatly improving the efficiency of locating the required key-value data and subsequent corresponding processing, and saving the I / O and computing costs of the storage system.
[0046] In particular, when performing a read operation on a column of key-value data (or data column), multiple key-value data can be quickly and batch-read only by using the beginning key data and the ending key data in the data column in the order of the key data, thereby further improving the efficiency of processing the key-value data. Figure 3AThe first key data K in the main storage tree T1 can correspond to the beginning key data, and the last key data K can correspond to the ending key data. By directly reading the key value data KV between the two data and the key value data corresponding to the associated data pair KR from the corresponding memory, the data column to be read can be quickly obtained. It should be understood that when the length of the data column is known, only the beginning key data can be obtained, and the ending key data can be obtained through the beginning key data. Figure 3B and Figure 3C An exemplary example of reading a data column is specifically shown.
[0047] Figure 3B FIG. 1 is a schematic block diagram of reading key-value data in a storage system 1200 according to an embodiment of the present disclosure. Figure 3B In FIG. 1 , the process of reading a column of key-value data (or a column of data) is schematically indicated by a dotted arrow represented by a circled number. S Indicates the beginning key data of the data column, K E Indicates the end key data of the data column. As an example, the storage system 1200 may receive a K as an input INPUT from any user terminal 1100. S and K E , after obtaining K S and K E Afterwards, as shown by arrow ①, it can be determined whether there is a value in the range [K S ,K E ] between the key data. Figure 3B As shown, there is no key data within the range in the memory table 1240. It should be understood that in other embodiments, there may be a portion of key data within the range in the memory table 1240. In this case, it can be determined that the key value data corresponding to the portion of key data needs to be read out from the memory table 1240.
[0048] Next, as an example, the range [K S ,K E ] in the key data. Figure 3B In the main storage tree T1, the key data K1 to K9 are located in the range [K S ,K E ], so the key value data KV with key data in the range [K1, K9] needs to be read out. Figure 3BAs shown in FIG. 3 , key value data K1V, K3V, K4V, K7V and K9V need to be read from the main storage tree T1, while key data K2, K5, K6 and K8 are associated with the indication data R. Therefore, as shown by arrow ③, key value data K2V and K5V can be read from the auxiliary storage tree T2-1, and key value data K6V and K8V can be read from the auxiliary storage tree T2-N according to the indication of the corresponding indication data R. In the above manner, the key value data K1V, K3V, K4V, K7V and K9V can be read from the main storage tree T1, and the key value data K2V, K5V, K6V and K8V can be read from the auxiliary storage tree T2-1 according to the indication of the corresponding indication data R. S ,K E ] All key value data (i.e. data columns) of the key data in ]. Afterwards, the read key value data can be output at once or in batches as shown by arrow ④.
[0049] It should be understood that Figure 3B The example is also applicable to the reading of single or multiple discontinuous key-value data. In this case, the only difference is that for each key data K included in the input INPUT, it is determined whether the key data exists in the memory table 1240 as shown by arrow ①. If not, it is determined whether the key data consistent with the key data in the main storage tree T1 is associated with the value data V or the indication data R as shown by arrow ②. If it is associated with the indication data R, the key-value data is read out from the corresponding auxiliary storage as shown by arrow ③. Afterwards, as an example, the read key-value data can be output at one time or in batches as shown by arrow ④.
[0050] Figure 3C A schematic block diagram of reading key-value data in a storage system according to another embodiment of the present disclosure is illustrated. Figure 3C and Figure 3B The difference is that in Figure 3C In the example of FIG. 1 , the storage system 1200 may receive the head key data K as the input INPUT from any user terminal 1100. S and list length L (but not the end key data K E ). Then, as an example, the equation K can be obtained by using the arrow ①' as shown in FIG. E =K S +L-1 to determine the end key data K E , and determine the K E With the received K S As a new input INPUT' Figure 3B The subsequent process is performed similarly. In addition, in some embodiments, Figure 3C and Figure 3B Another difference is that Figure 3C The example also has sub-memory tables 1240-1, ..., 1240-N, and further determines whether there is a corresponding sub-memory table 1240-1, 1240-N in the range [K S ,K E] and then read the key value data from the corresponding auxiliary storage tree as shown by arrow ③.
[0051] Figure 4 A schematic block diagram of querying key-value data in a storage system 1200 according to an embodiment of the present disclosure is illustrated.
[0052] Figure 4 The key-value data KV is shown as Figure 2A or Figure 2B An example of performing a query operation on the stored key-value data KV after being stored in the storage system 1200 is shown.
[0053] For the query operation, as an example, the storage system 1200 may receive key data K as input INPUT from any user terminal 1100. X It should be understood that in other embodiments, the input INPUT may include more key data. Then, as an example, the key data K X To determine whether the queried key-value data is stored in the storage system 1200.
[0054] As an example, the received key data K X Compare with the key data K in the key value data KV in the memory table 1240 that has not been dumped (for example, Figure 4 As shown by the arrow (1) in FIG. 1 , if the memory table 1240 contains the key data K corresponding to the received key data K, X If there is consistent key data, it can be determined that the queried key value data exists (for example, Figure 4 As an example, if the received key data K does not exist in the memory table 1240, X If the key data K is consistent, the received key data K X and compare it with the key data K stored in the main storage tree T1 in the memory 1210 (for example, Figure 4 As shown by the arrow (2) in the figure). If the main storage tree T1 contains the key data K X If the key data K is consistent with the key data (regardless of whether the key data K is the key data in the key-value data KV or the key data in the associated data pair KR), it can be determined that the queried key-value data exists (for example, Figure 4 The query result is output as shown by the arrow (3) in FIG. 1 ). After determining that the main storage tree T1 does not contain the received key data K X When the key data is consistent, Figure 4 The query result that no relevant key value data is found is output as shown by the arrow (3) in FIG. Figure 2B In the case of the sub-WAL file and sub-memory table shown in the figure, the above operations can also be performed on the sub-memory table.
[0055] For such processing operations that only require key data K (Key-only), since there is no need to perform any operations on the memory 1220 with a lower access speed, the processing efficiency of processing key data can be further improved.
[0056] Figures 2A to 4 Only some examples of the way of processing the key-value data KV according to the embodiments of the present invention are shown. It should be understood that the above-mentioned ways can be used to perform any other processing on the key-value data KV.
[0057] Figure 5 A flowchart 500 of a method for processing key-value data according to an embodiment of the present disclosure is illustrated.
[0058] Reference Figure 5 , in box 502, key-value data KV and a storage level corresponding to the key-value data are obtained, and the key-value data includes key data K and value data V. In some embodiments, the storage level may be a first level or a second level, and the first level may be higher than the second level. In some embodiments, the first level may be the highest storage level and corresponds to a first memory 1210 in the storage system, and the first memory has a main storage tree T1. The second level may be a non-highest storage level and corresponds to a second memory 1220 in the storage system. The second level may include at least one second sub-level, and the second memory may include at least one second sub-memory. At least one second sub-level may correspond one-to-one to at least one second sub-memory. Each second sub-memory may have a corresponding auxiliary storage tree T2-1,...,TN. In some embodiments, the main storage tree and each auxiliary storage tree are B+ trees. In some embodiments, the first level and at least one second sub-level are used to indicate different storage performances of different memories in the storage system. For example, as described above with reference to Figures 1 to 4 described.
[0059] In block 504, in response to the storage level being the first level, the key value data KV is stored in the primary storage tree T1 in the first memory in the storage system. In block 506, in response to the storage level being the second level, the key data K is stored in the primary storage tree T1, and the key value data KV is stored in the secondary storage trees T2-1, ..., TN in the second memory in the storage system.
[0060] In some embodiments, the storage system may further include: a write-ahead log WAL file 1230, and a memory table 1240. The WAL file 1230 may be located in a predetermined non-volatile memory in the storage system 1200, and the memory table 1240 may be located in a predetermined volatile memory in the storage system 1200. In this case, in some embodiments, the method for processing key-value data according to an embodiment of the present disclosure may further include: storing the key-value data KV in the WAL file 1230 in the acquisition order. In some embodiments, the method may further include: storing the key-value data KV in the memory table 1240 in the key data order for the key data. In some embodiments, the method may further include: determining whether a dump condition for dumping from the memory table 1240 to the first memory 1210 and at least one second sub-memory 1220-1, ..., 1220-N is satisfied, and the dump condition is that the number of key-value data stored in the memory table 1240 reaches a predetermined threshold. In some embodiments, the method may further include: if it is determined that the dump condition is satisfied, for each key-value data KV in the memory table, determining whether the corresponding storage level is the first level or the second level. Thereafter, the above blocks 504 and 506 may be executed.
[0061] Alternatively, in some embodiments, the following operation may be performed before executing the above-mentioned blocks 504 and 506: for each key-value data KV stored in the storage table 1240, the key-value data corresponding to the first level is determined as the first key-value data (as shown in the blank box in FIG. 2), and the key-value data corresponding to the second level is determined as the second key-value data (as shown in the oblique line shaded box in FIG. 2). In some embodiments, the method may also include: for each second key-value data, generating indication data R according to the second sub-level corresponding to the second key-value data, so as to generate an associated data pair KR consisting of the key data K in the second key-value data and the indication data. The indication data R indicates the second sub-memory where the second key-value data should be stored. In this case, in some embodiments, in block 504, each first key-value data KV and each associated data pair KR may be dumped into the main storage tree T1 in the first memory 1210 in the order of the key data. In block 506, each second key value data may be dumped into the auxiliary storage trees T2-1, ..., TN in the second sub-memories 1220-1, ..., 1220-N indicated by the corresponding indication data R in the order of the key data.
[0062] In some embodiments, after the dump to the first memory 1210 and the second sub-memory 1220-1, ..., 1220-N is completed, the key-value data KV in the WAL file 1230 may be deleted. In some embodiments, when the dump is not completed and the dump is interrupted due to power failure of the storage system 1200, the WAL file 1230 may be used to replay the key-value data KR that has not been dumped, so as to dump the key-value data KR that has not been dumped into the primary storage tree T1 or the corresponding auxiliary storage trees T2-1, ..., TN by storing the key-value data KR that has not been dumped into the memory table 1240.
[0063] In addition, in some embodiments, in order to reduce the playback cost and at the same time not significantly increase the workload of writing, the method may also include determining whether the proportion of all second key-value data in the memory table 1240 is less than a predetermined proportion threshold. In some embodiments, the method may also include establishing a sub-WAL file and a sub-memory table corresponding to each second sub-memory 1220-1, ..., 1220-N in response to determining that the proportion is less than the predetermined proportion threshold. In some embodiments, each sub-WAL file and the corresponding sub-memory table include the second key-value data copied from the memory table 1240 and to be stored in the corresponding second sub-memory. In this case, in some embodiments, in box 506, for each second sub-memory, each second key-value data in the corresponding sub-memory table may be dumped into the auxiliary storage tree in the second sub-memory.
[0064] In this case, in some embodiments, the key-value data in the WAL file may be deleted after the dump to the first memory 1210 is completed. After the dump to the corresponding second sub-memory is completed, the key-value data in the corresponding sub-WAL file is deleted. In the case where the dump to the first memory 1210 or any second sub-memory 1220-1, ..., 1220-N is not completed and the dump is interrupted due to power failure of the storage system 1200, the WAL file 1230 and the sub-WAL file (for example, 1230-1, etc.) can be used to replay the key-value data KV that has not yet been dumped, so as to dump the key-value data KV that has not yet been dumped into the main storage tree T1 or the corresponding auxiliary storage tree T2-1, ..., TN by storing it in the memory table 1240 or the corresponding sub-memory table (for example, 1240-1, etc.). As described above with reference to Figure 2A and Figure 2B described.
[0065] After the key-value data is stored as above, any operation may be performed on the stored key-value data. In some embodiments, the method for processing key-value data according to an embodiment of the present disclosure may further include: obtaining operation key data K in the operation key-value data KV that needs to be operated in the storage system 1200. In some embodiments, the method may further include determining the storage location of the operation key-value data KV in the storage system 1200 according to the operation key data K. In some embodiments, the method may further include operating the key-value data KV at the storage location. In some embodiments, the storage location may include a memory table 1240 (or a sub-memory table). In some embodiments, the storage location may include a main storage tree T1. In some embodiments, the storage location may include auxiliary storage trees T2-1, ..., TN in at least one second sub-memory 1220-1, ..., 1220-N.
[0066] In some embodiments, the storage location of the operation key value data KV in the storage system 1200 may be determined based on whether the key value data K corresponding to the operation key data K exists in the memory table 1240 (or the sub-memory table). In some embodiments, the storage location of the operation key value data KV in the storage system 1200 may be determined based on whether the key value data KV corresponding to the operation key data K exists in the main storage tree T1. In some embodiments, the storage location of the operation key value data KV in the storage system 1200 may be determined based on the auxiliary storage tree of the second memory indicated by the indication data R corresponding to the operation key data K in the main storage tree T1. In addition, in some embodiments, the operation key value data may include a column of operation key value data, and the operation key data may include the beginning key data and the ending key data of the column of operation key value data in the key data order. In this case, in some embodiments, the storage location of the column of operation key value data in the storage system 1200 may also be determined based on the beginning key data and the ending key data. In some embodiments, the above operation may include a read operation. In some embodiments, the above operation may include a delete operation. In some embodiments, the above operation may include an edit operation. In some embodiments, when the above operation may include a read operation, in some embodiments, the read key value data may be output after all key value data are read. In some embodiments, the read key value data may be output after a predetermined amount of key value data is read. For example, as described above with reference to FIG. 3.
[0067] After storing the key-value data as above, any other operations may be performed on the stored key-value data. In some embodiments, the method for processing key-value data according to an embodiment of the present disclosure may further include: obtaining query key data K of the query key-value data KV to be queried. In some embodiments, the method may further include determining whether the memory table 1240 (or the sub-memory table) or the main storage tree T1 includes key data consistent with the query key data K. In some embodiments, the method may further include determining that the query key-value data KV is queried in the storage system 1200 when it is determined that the key data consistent with the query key data is included.
[0068] According to the method for processing key-value data in an embodiment of the present disclosure, it is possible to establish associations between different memories in a storage system through key data in the key-value data. Therefore, in the process of locating the key-value data required by the user, it is only necessary to operate the memories with higher storage performance, without operating the memories with lower storage performance. This can greatly improve the efficiency of locating the key-value data and subsequent processing, and improve the overall performance of the storage system.
[0069] Figure 6 A block diagram of an electronic device 600 for processing key-value data according to an embodiment of the present disclosure is illustrated. Figure 6 The electronic device 600 shown can interact with the storage system 1200 or be integrated in the storage system 1200. For example, the electronic device 600 can be Figure 1 The user terminal 1100 or the processor in the storage system 1200 is shown.
[0070] The electronic device 600 may include at least one processor 610 and a memory 620. The memory 620 is coupled to the at least one processor 610 and has instructions 621 stored thereon. The instructions 621, when executed by the at least one processor 610, cause the electronic device 600 to perform the following actions: obtain key-value data and a storage level corresponding to the key-value data, the key-value data including key data and value data; in response to the storage level being a first level, store the key-value data in a primary storage tree in a first memory in a storage system; and in response to the storage level being a second level, store the key data in the primary storage tree and store the key-value data in a secondary storage tree in a second memory in the storage system, the first level being higher than the second level.
[0071] In some embodiments, the first level is the highest storage level, the second level includes at least one second sub-level, wherein the second memory includes at least one second sub-memory, at least one second sub-level corresponds one-to-one with at least one second sub-memory, and each second sub-memory has a corresponding auxiliary storage tree, wherein the first level and at least one second sub-level are used to indicate different storage performances of different memories in the storage system.
[0072] In some embodiments, the main storage tree and each auxiliary storage tree are B+ trees. The storage system also includes: a write-ahead log WAL file and a memory table. The WAL file is located in a predetermined non-volatile memory in the storage system, and the memory table is located in a predetermined volatile memory in the storage system.
[0073] In some embodiments, the actions performed by the electronic device 600 may also include: storing the key-value data in a WAL file in the order of acquisition; storing the key-value data in a memory table in the key data order for the key data; determining whether a dump condition for dumping from the memory table to a first memory and at least one second sub-memory is met, the dump condition being that the number of key-value data stored in the memory table reaches a predetermined threshold; and when it is determined that the dump condition is met, determining, for each key-value data in the memory table, whether the corresponding storage level is the first level or the second level.
[0074] In some embodiments, the actions performed by the electronic device 600 may also include: for each key-value data stored in the storage table, determining the key-value data corresponding to the first level as the first key-value data, and determining the key-value data corresponding to the second level as the second key-value data; and for each second key-value data, generating indication data according to the second sub-level corresponding to the second key-value data to generate an associated data pair consisting of the key data and the indication data in the second key-value data. The indication data indicates the second sub-memory where the second key-value data should be stored. In this case, in some embodiments, each first key-value data and each associated data pair are dumped into the main storage tree in the first memory in the order of the key data; and each second key-value data is dumped into the auxiliary storage tree in the second sub-memory indicated by the corresponding indication data in the order of the key data.
[0075] In addition, the electronic device 600 may also perform the above reference Figures 1 to 5 Any other actions described.
[0076] According to the electronic device of the embodiment of the present disclosure, it is possible to establish associations between different memories in the storage system through key data in the key-value data, so that in the process of locating the key-value data required by the user, it is only necessary to operate the memory with higher storage performance, and there is no need to operate the memory with lower storage performance, thereby greatly improving the efficiency of locating the key-value data and subsequent processing, and improving the overall performance of the storage system.
[0077] Figure 7 A schematic block diagram of an example device 700 that may be used to implement embodiments of the present disclosure is shown. Figure 6The electronic device of the present invention can be realized by using the device 700. As shown in the figure, the device 700 includes a central processing unit (CPU) 701, which can perform various appropriate actions and processes according to computer program instructions stored in a read-only memory (ROM) 702 or computer program instructions loaded from a storage unit 708 to a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the device 700 can also be stored. The CPU 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0078] A number of components in the device 700 are connected to the I / O interface 705, including an input unit 706, such as a keyboard, a mouse, etc., an output unit 707, such as various types of displays, speakers, etc., a storage unit 708, such as a disk, an optical disk, etc., and a communication unit 709, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 709 allows the device 700 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0079] The various processes and processing described above, such as method 500, may be performed by processing unit 701. For example, in some embodiments, method 500 may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as storage unit 708. In some embodiments, part or all of the computer program may be loaded and / or installed on device 700 via ROM 702 and / or communication unit 709. When the computer program is loaded into RAM 703 and executed by CPU 701, one or more actions of method 500 described above may be performed.
[0080] The present disclosure may be a method, an apparatus, a system and / or a computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for executing various aspects of the present disclosure.
[0081] Computer readable storage medium can be a tangible device that can hold and store instructions used by an instruction execution device. Computer readable storage medium can be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination thereof. More specific examples (non-exhaustive lists) of computer readable storage medium include portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), static random access memories (SRAM), portable compact disk read-only memories (CD-ROM), digital versatile disks (DVD), memory sticks, floppy disks, mechanical encoding devices, such as punch cards or convex structures in grooves on which instructions are stored, and any suitable combination thereof. Computer readable storage medium used here is not interpreted as a transient signal itself, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagated by waveguides or other transmission media (e.g., light pulses by optical fiber cables), or electrical signals transmitted by wires.
[0082] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, optical fiber transmissions, wireless transmissions, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in the computer-readable storage medium in each computing / processing device.
[0083] The computer program instructions for performing the operation of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages, such as Smalltalk, C++, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. Computer-readable program instructions may be executed completely on a user's computer, partially on a user's computer, as an independent software package, partially on a user's computer, partially on a remote computer, or completely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., using an Internet service provider to connect via the Internet). In some embodiments, an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), may be customized by utilizing the state information of the computer-readable program instructions, and the electronic circuit may execute the computer-readable program instructions, thereby realizing various aspects of the present disclosure.
[0084] Various aspects of the present disclosure are described herein with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer-readable program instructions.
[0085] These computer-readable program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processing unit of the computer or other programmable data processing device, a device that implements the functions / actions specified in one or more boxes in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0086] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operating steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0087] The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to multiple embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a part of a module, program segment or instruction, and a part of the module, program segment or instruction includes one or more executable instructions for realizing the specified logical function. In some alternative implementations, the function marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous square boxes can actually be executed substantially in parallel, and they can sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or action, or can be implemented with a combination of special hardware and computer instructions.
[0088] The embodiments of the present disclosure have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or technical improvements to the technology in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.
Claims
1. A method for processing key-value data, comprising: Acquire key-value data and a storage level corresponding to the key-value data, the key-value data including key data and value data, the storage level indicating a storage performance level of a memory in a storage system; In response to the storage level being the first level, storing the key-value data in a main storage tree in a first memory in the storage system; as well as In response to the storage level being a second level, the key data is stored in the primary storage tree and the key-value data is stored in a secondary storage tree in a second memory in the storage system, the first level being higher than the second level.
2. The method according to claim 1, wherein the first level is a highest storage level, the second level includes at least one second sub-level, The second memory includes at least one second sub-memory, the at least one second sub-level corresponds to the at least one second sub-memory in a one-to-one manner, and each second sub-memory has a corresponding auxiliary storage tree, The first level and the at least one second sub-level are used to indicate different storage performances of different memories in the storage system.
3. The method according to claim 2, wherein the primary storage tree and each secondary storage tree are B+ trees, The storage system further comprises: Write-ahead log WAL files and memory tables, The WAL file is located in a predetermined non-volatile memory in the storage system, and the memory table is located in a predetermined volatile memory in the storage system.
4. The method according to claim 3, further comprising: The key value data is stored in the WAL file in the order of acquisition; Storing the key value data in the memory table according to the key data order for the key data; Determine whether a dump condition for dumping from the memory table to the first memory and the at least one second sub-memory is met, the dump condition being that the number of key-value data stored in the memory table reaches a predetermined threshold; as well as When it is determined that the dump condition is met, for each key-value data in the memory table, it is determined whether the corresponding storage level is the first level or the second level.
5. The method according to claim 4, further comprising: For each key-value data stored in the storage table, determining the key-value data corresponding to the first level as the first key-value data, and determining the key-value data corresponding to the second level as the second key-value data; as well as For each second key-value data, generating indication data according to the second sub-level corresponding to the second key-value data, so as to generate an associated data pair consisting of the key data in the second key-value data and the indication data, wherein the indication data indicates the second sub-memory in which the second key-value data should be stored, wherein each first key value data and each associated data pair are dumped into the main storage tree in the first memory in the order of the key data; as well as According to the key data sequence, each second key value data is dumped into the auxiliary storage tree in the second sub-storage indicated by the corresponding indication data.
6. The method according to claim 5, further comprising: After completing the dumping to the first storage device and all the second sub-storage devices, deleting the key value data in the WAL file, Wherein, when the dump is not completed and the dump is interrupted due to power failure of the storage system, the WAL file is used to play back the key-value data that has not been dumped, so as to dump the key-value data that has not been dumped into the primary storage tree or the corresponding auxiliary storage tree by storing the key-value data that has not been dumped in the memory table.
7. The method according to claim 5, further comprising: Determine whether the proportion of all second key value data in the memory table is less than a predetermined proportion threshold; as well as In response to determining that the ratio is less than the predetermined ratio threshold, establishing a sub-WAL file and a sub-memory table corresponding to each second sub-storage, Each sub-WAL file and the corresponding sub-memory table include second key-value data copied from the memory table and to be stored in the corresponding second sub-memory.
8. The method according to claim 7, wherein dumping each second key value data into the auxiliary storage tree in the second sub-storage indicated by the corresponding indication data according to the key data sequence comprises: For each second sub-memory, each second key-value data in the corresponding sub-memory table is dumped into the auxiliary storage tree in the second sub-memory.
9. The method according to claim 7, further comprising: After completing the dumping to the first storage device, deleting the key-value data in the WAL file; as well as After completing the dump to the corresponding second sub-storage, delete the key value data in the corresponding sub-WAL file. Wherein, when the dump to the first memory or any second sub-memory is not completed and the dump is interrupted due to power failure of the storage system, the WAL file and the sub-WAL file are used to play back the key-value data that has not been dumped, so as to dump the key-value data that has not been dumped into the main storage tree or the corresponding auxiliary storage tree by storing the key-value data that has not been dumped into the memory table or the corresponding sub-memory table.
10. The method according to claim 5, further comprising: Acquire operation key data in the operation key value data that needs to be operated in the storage system; Determine, according to the operation key data, a storage location of the operation key value data in the storage system, wherein the storage location includes at least one of the memory table, the main storage tree, or a secondary storage tree in the at least one second sub-storage; as well as An operation is performed on the key-value data at the storage location.
11. The method according to claim 10, wherein the storage location of the operation key data in the storage system is determined based on at least one of the following: Whether there is key value data corresponding to the operation key data in the memory table, Whether there is key value data corresponding to the operation key data in the main storage tree, or The auxiliary storage tree of the second memory indicated by the indication data corresponding to the operation key data in the main storage tree.
12. The method according to claim 11, wherein the operation key data comprises a column of operation key data, the operation key data comprises the beginning key data and the ending key data of the column of operation key data in the order of the key data, The storage location of the column operation key value data in the storage system is also determined based on the beginning key data and the ending key data.
13. The method according to claim 12, wherein the operation comprises any one of the following: a read operation, a delete operation, or an edit operation, Wherein, when the operation includes a read operation, the operation on the key-value data at the storage location includes: After reading all the key-value data, output the read key-value data; or After a predetermined amount of key-value data is read, the read key-value data is output.
14. The method according to claim 5, further comprising: Obtain query key data of query key value data to be queried; determining whether at least one item in the memory table or the main storage tree includes key data consistent with the query key data; as well as In a case where it is determined that the key data is consistent with the query key data, it is determined that the query key value data is queried in the storage system.
15. An electronic device, comprising: at least one processor; as well as a memory coupled to the at least one processor and having instructions stored thereon, the instructions, when executed by the at least one processor, causing the electronic device to perform actions, the actions comprising: Acquire key-value data and a storage level corresponding to the key-value data, the key-value data including key data and value data, the storage level indicating a storage performance level of a memory in a storage system; In response to the storage level being the first level, storing the key-value data in a main storage tree in a first memory in the storage system; and In response to the storage level being a second level, the key data is stored in the primary storage tree and the key-value data is stored in a secondary storage tree in a second memory in the storage system, the first level being higher than the second level.
16. The electronic device according to claim 15, wherein the first level is a highest storage level, the second level includes at least one second sub-level, The second memory includes at least one second sub-memory, the at least one second sub-level corresponds to the at least one second sub-memory in a one-to-one manner, and each second sub-memory has a corresponding auxiliary storage tree, The first level and the at least one second sub-level are used to indicate different storage performances of different memories in the storage system.
17. The electronic device according to claim 16, wherein the main storage tree and each auxiliary storage tree are B+ trees, The storage system further comprises: Write-ahead log WAL files and memory tables, The WAL file is located in a predetermined non-volatile memory in the storage system, and the memory table is located in a predetermined volatile memory in the storage system.
18. The electronic device according to claim 17, wherein the actions further comprise: The key value data is stored in the WAL file in the order of acquisition; Storing the key value data in the memory table according to the key data order for the key data; Determine whether a dump condition for dumping from the memory table to the first memory and the at least one second sub-memory is met, the dump condition being that the number of key-value data stored in the memory table reaches a predetermined threshold; as well as When it is determined that the dump condition is met, for each key-value data in the memory table, it is determined whether the corresponding storage level is the first level or the second level.
19. The electronic device of claim 18, wherein the actions further comprise: For each key-value data stored in the storage table, determining the key-value data corresponding to the first level as the first key-value data, and determining the key-value data corresponding to the second level as the second key-value data; as well as For each second key-value data, generating indication data according to the second sub-level corresponding to the second key-value data, so as to generate an associated data pair consisting of the key data in the second key-value data and the indication data, wherein the indication data indicates the second sub-memory in which the second key-value data should be stored, wherein each first key value data and each associated data pair are dumped into the main storage tree in the first memory in the order of the key data; as well as According to the key data sequence, each second key value data is dumped into the auxiliary storage tree in the second sub-storage indicated by the corresponding indication data.
20. A computer program product tangibly stored on a non-transitory computer readable medium and comprising machine executable instructions which, when executed, cause a machine to: Acquire key-value data and a storage level corresponding to the key-value data, the key-value data including key data and value data, the storage level indicating a storage performance level of a memory in a storage system; In response to the storage level being the first level, storing the key-value data in a main storage tree in a first memory in the storage system; as well as In response to the storage level being a second level, the key data is stored in the primary storage tree and the key-value data is stored in a secondary storage tree in a second memory in the storage system, the first level being higher than the second level.