A data processing method and apparatus

By processing key-value pairs in parallel, Jedis's performance bottleneck in high-concurrency environments is solved, achieving efficient data processing, improving application performance and user experience, and making it suitable for data processing needs in multiple fields.

CN120804191BActive Publication Date: 2026-07-03SHENZHEN PENGLAI SMART NUMBER TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHENZHEN PENGLAI SMART NUMBER TECH CO LTD
Filing Date
2024-06-25
Publication Date
2026-07-03

AI Technical Summary

Technical Problem

Existing Jedis clients suffer from performance bottlenecks and blocking issues in high-concurrency environments, and lack built-in connection pools, leading to increased development complexity and failing to meet the needs of Java developers for efficient connection and operation in high-concurrency environments.

Method used

A data processing method and apparatus are provided, which receives data processing instructions from the client and processes key-value pair data in parallel. By leveraging the multi-core performance advantage of the HetuKV key-value database, parallel data processing is achieved, thereby improving application performance and reducing operation latency.

Benefits of technology

It achieves efficient parallel data processing, improves application performance, reduces operation latency, and enhances data processing efficiency and user experience. It is suitable for data processing needs in fields such as artificial intelligence, content recommendation, image rendering, financial risk control, Internet of Things, and game development.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120804191B_ABST
    Figure CN120804191B_ABST
Patent Text Reader

Abstract

The application discloses a data processing method, which can perform parallel data processing on key-value pair data in a key-value database according to at least one data processing instruction, obtain data processing results respectively corresponding to the at least one data processing instruction, and feed back the data processing results respectively corresponding to the at least one data processing instruction to the client, so that the client can be efficiently connected to the key-value database by using preset data processing instructions, and the parallel data processing can be performed on the key-value pair data in the key-value database, efficient parallel data processing is realized, the performance of an application program is improved, the performance of the client is improved, operation delay is reduced, the efficiency of data processing is improved, data processing cost is reduced, and user experience of data processing is improved.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application is a divisional application of the invention application filed on June 25, 2024, with Chinese application number 202410829376.7 and title "A Data Processing Method and Apparatus". Technical Field

[0002] This invention relates to the field of data processing technology, and in particular to a data processing method and apparatus. Background Technology

[0003] NoSQL databases are a type of database that emerged outside of relational databases, designed to address the challenges of large-scale data storage and high-concurrency access that traditional relational databases struggle to handle. Key-value databases are a major type of NoSQL database; they store data in key-value pairs, suitable for simple data models and fast read / write operations. Redis, in particular, as an in-memory key-value database, is widely used due to its fast read / write operations and rich features (such as publish / subscribe, transactions, and pipelining).

[0004] In the Java development field, with the rapid development of internet applications, the demand for high performance, scalability, and flexibility is increasing daily. Traditional relational databases may face performance bottlenecks when handling large amounts of data and high concurrency requests, so developers have begun to seek alternatives. The emergence of key-value databases fills this gap and provides Java developers with more options. Java is a widely used programming language applied in enterprise, network, mobile, and embedded systems. Many enterprise applications and microservice architectures are based on the Java technology stack. Developing Java interfaces for key-value databases enables these applications to easily access and manipulate key-value databases, meeting the needs of various application scenarios.

[0005] Key-value databases typically feature high performance and scalability because they are based on a simple key-value data model, allowing for fast read and write operations. Through Java interfaces, developers can leverage the performance advantages of key-value databases for applications requiring caching, session management, and real-time data processing. Developing Java interfaces for key-value databases simplifies the development process by abstracting and encapsulating database operations. Developers can interact with key-value databases using familiar Java APIs without needing to delve into the underlying database implementation. This simplification helps improve development efficiency and reduce the probability of errors.

[0006] In the current technology landscape, Jedis is a Java client library for Redis, providing comprehensive support and direct mapping to Redis commands. Jedis provides wrappers for Redis commands, including strings, hashes, sets, sorted sets, transactions, publish / subscribe, and more. It also provides an API that allows developers to interact with Redis using native commands.

[0007] Jedis operates synchronously, meaning it blocks while waiting for a Redis response. This can lead to performance bottlenecks, especially in high-concurrency environments. Because of its synchronous nature, Jedis is unsuitable for scenarios requiring non-blocking and asynchronous operations. Jedis does not come with a built-in connection pool; additional configuration is needed to manage connections, which can increase development complexity. Therefore, there is a pressing need for a method that enables Java clients to efficiently connect to key-value databases in high-concurrency environments. Summary of the Invention

[0008] This invention provides a data processing method and apparatus that enables clients to efficiently connect to a key-value database using preset data processing instructions. It allows for parallel data processing of key-value pairs within the database, achieving efficient parallel data processing. This improves application performance, enhances client performance, reduces operational latency, and ultimately increases data processing efficiency, lowers data processing costs, and enhances the user experience of data processing.

[0009] In a first aspect, the present invention provides a data processing method, the method being applied to a solid-state drive corresponding to a key-value database, the method comprising:

[0010] Receive at least one data processing instruction sent by the client; wherein each data processing instruction includes: target set type data, target set operation type;

[0011] Parallel data processing is performed on the at least one data processing instruction to obtain the data processing result corresponding to each of the at least one data processing instruction; wherein, for each data processing instruction, target key-value pair data in the key-value database is determined according to the target set type data, wherein each key-value pair data in the key-value database includes a key and at least one value, each value includes at least one ordered set, and each ordered set includes at least one element, wherein each element includes at least one field and data values ​​corresponding to each field, and multiple elements in each ordered set are sorted according to the data values ​​corresponding to preset fields; data processing corresponding to the target set operation type is performed on the target key-value pair data to obtain the data processing result corresponding to the data processing instruction;

[0012] The data processing results corresponding to each of the at least one data processing instruction are fed back to the client.

[0013] In a second aspect, the present invention provides a data processing apparatus applied to a solid-state drive corresponding to a key-value database, the apparatus comprising:

[0014] The first unit is used to receive at least one data processing instruction sent by the client; wherein each data processing instruction includes: target set type data and target set operation type;

[0015] The second unit is used to perform parallel data processing on the at least one data processing instruction to obtain the data processing result corresponding to each of the at least one data processing instruction; wherein, for each data processing instruction, target key-value pair data in the key-value database is determined according to the target set type data, wherein each key-value pair data in the key-value database includes a key and at least one value, each value includes at least one ordered set, and each ordered set includes at least one element, wherein each element includes at least one field and data values ​​corresponding to each field, and multiple elements in each ordered set are sorted according to the data values ​​corresponding to preset fields; the target key-value pair data is processed according to the data processing type corresponding to the target set operation to obtain the data processing result corresponding to the data processing instruction;

[0016] The third unit is used to feed back the data processing results corresponding to each of the at least one data processing instruction to the client.

[0017] Thirdly, the present invention provides a readable medium including executable instructions, which, when executed by a processor of an electronic device, cause the electronic device to perform any of the methods described in the first aspect.

[0018] Fourthly, the present invention provides an electronic device including a processor and a memory storing execution instructions, wherein when the processor executes the execution instructions stored in the memory, the processor performs the method as described in any of the first aspects.

[0019] As can be seen from the above technical solution, the method provided by the present invention can be applied to solid-state drives corresponding to key-value databases. The method includes: receiving at least one data processing instruction sent by a client; wherein each data processing instruction includes: target set type data and target set operation type; performing parallel data processing on the at least one data processing instruction to obtain data processing results corresponding to each of the at least one data processing instruction; wherein, for each data processing instruction, determining target key-value pair data in the key-value database based on the target set type data, wherein each key-value pair data in the key-value database includes a key and at least one value, each value includes at least one ordered set, and each ordered set includes at least one element, wherein each element includes at least one field and data values ​​corresponding to each field, and multiple elements in each ordered set are sorted according to the data values ​​corresponding to preset fields; performing data processing on the target key-value pair data corresponding to the target set operation type to obtain data processing results corresponding to the data processing instruction; and feeding back the data processing results corresponding to each of the at least one data processing instruction to the client. In this application, key-value pairs in a key-value database can be processed in parallel according to at least one data processing instruction to obtain the data processing result corresponding to each of the at least one data processing instruction. The data processing result corresponding to each of the at least one data processing instruction is then fed back to the client. Therefore, this application can use preset data processing instructions to enable the client to efficiently connect to the key-value database and perform parallel data processing on the key-value pairs in the key-value database. This achieves efficient parallel data processing, thereby improving the performance of the application and the client, reducing operation latency, and ultimately improving the efficiency of data processing, reducing data processing costs, and improving the user experience of data processing.

[0020] The further effects of the aforementioned non-conventional preferred method will be explained below in conjunction with specific embodiments. Attached Figure Description

[0021] To more clearly illustrate the embodiments of the present invention or the existing technical solutions, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0022] Figure 1 This is a flowchart illustrating a data processing method according to an embodiment of the present invention.

[0023] Figure 2This is a flowchart illustrating a data processing method according to an embodiment of the present invention.

[0024] Figure 3 This is a flowchart illustrating a data processing method according to an embodiment of the present invention.

[0025] Figure 4 This is a flowchart illustrating a data processing method according to an embodiment of the present invention.

[0026] Figure 5 This is a flowchart illustrating a data processing method according to an embodiment of the present invention.

[0027] Figure 6 This is a flowchart illustrating a data processing method according to an embodiment of the present invention.

[0028] Figure 7 This is a flowchart illustrating a data processing method according to an embodiment of the present invention.

[0029] Figure 8 This is a flowchart illustrating a data processing method according to an embodiment of the present invention.

[0030] Figure 9 This is a flowchart illustrating a data processing method according to an embodiment of the present invention.

[0031] Figure 10 This is a schematic diagram of the structure of a data processing device according to an embodiment of the present invention;

[0032] Figure 11 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation

[0033] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this invention, and not all of them. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this invention.

[0034] Various non-limiting embodiments of the present invention will now be described in detail with reference to the accompanying drawings.

[0035] See Figure 1 This paper illustrates a data processing method according to an embodiment of the present invention. The method can be applied to a solid-state drive corresponding to a key-value database. In this embodiment, the method may include, for example, the following steps:

[0036] Step 1: Receive at least one data processing instruction sent by the client.

[0037] In this embodiment, when a client needs to process key-value pairs in a key-value database via a solid-state drive (SSD), the client can send at least one data processing instruction to the SSD corresponding to the key-value database. In one implementation, the client can be a Java client, and the key-value database can be a combined key-value database (i.e., a HetuKV key-value database).

[0038] Each data processing instruction may include: target set type data and target set operation type. Target set type data can be understood as the data set to be processed and / or related information about the elements within that data set. For example, the key and / or value of the key-value pair to be processed. It should be noted that each key-value pair in the key-value database includes a key and at least one value. Each value includes at least one sorted set, and each sorted set includes at least one element. Each element includes at least one field and the corresponding data value for each field. Multiple elements in each sorted set are sorted according to the data values ​​corresponding to preset fields. A sorted set is a data structure characterized by unique and ordered elements. A ranking table of grades is an example of a sorted set. The target set operation type can be understood as the operation method to be performed on the key-value pair to be processed, such as querying, deleting, adding, etc.

[0039] It should be noted that the key-value pairs in the key-value database can be relevant data from fields such as artificial intelligence, content recommendation, image rendering, financial risk control, the Internet of Things, game development, and big data analysis. For example, in the field of artificial intelligence, the solution provided in this application can be used to train and deploy machine learning and deep learning models. Applications include: reading and processing large amounts of training data, rapidly preprocessing data, caching intermediate results, and storing trained models in a high-speed cache for real-time inference and prediction. In the field of content recommendation systems, which typically require rapid access to and processing of large amounts of user and content data to generate personalized recommendations, the solution provided in this application can be used to cache user preferences, recommendation history, and popular content to reduce database read pressure and improve the real-time performance and accuracy of the recommendation system. In the field of image rendering and processing, rapid access to and caching of intermediate results is crucial for performance. The solution provided in this application can be used to store and cache intermediate data generated during the rendering process, such as textures, image slices, and rendering results, helping to accelerate the rendering process and reduce computational load. Financial institutions need to rapidly process and analyze large amounts of transaction and user data to detect fraudulent activities and... For risk management, the solution provided in this application can be used to cache and quickly access transaction records, account information, risk assessment results, etc., thereby improving the real-time response capability and data processing performance of the risk control system. In the Internet of Things (IoT) field, IoT devices generate a large amount of data, and the rapid processing and analysis of this data is crucial for system stability and performance. The solution provided in this application can be used to store and cache sensor data, device status, real-time events, etc., helping IoT systems to respond quickly to events and instructions and ensuring the real-time performance of the system. Game development requires processing a large amount of real-time data, including game status, player information, and game events. The solution provided in this application can be used to cache game status, player data, leaderboards, etc., to improve the game's response speed and performance. Big data analysis requires the rapid processing and analysis of large amounts of data to obtain valuable insights. The solution provided in this application can be used as a data processing relay station to help realize the rapid import, processing, and caching of data, thereby improving the performance of the analysis system.

[0040] Step 2: Perform parallel data processing on the at least one data processing instruction to obtain the data processing result corresponding to each of the at least one data processing instruction.

[0041] In this embodiment, if multiple data processing instructions are received simultaneously, these instructions can be processed in parallel to obtain the data processing results corresponding to each of the at least one instruction. For example, when the client is a Java client and the key-value database is a HetuKV key-value database, the multi-core performance advantage of the HetuKV key-value database can be utilized to achieve efficient parallel data processing, thereby improving the performance of the application. The HetuKV key-value database supports multi-core parallelism, and the Java client supports and can implement multi-threading. Therefore, multiple CPU cores can be activated, with each core processing a single data processing instruction. For example, when storing a large String file in a multi-core environment, the file can be split into multiple parts, with each core storing a separate portion of the data, allowing for simultaneous and non-interfering processing. This multi-core parallel processing method can greatly improve data processing performance.

[0042] Specifically, for each data processing instruction, the target key-value pair data in the key-value database can be determined first based on the target set type data. That is, the target key-value pair data corresponding to the target set type data can be queried from the key-value database based on the target set type data. Each key-value pair data in the key-value database includes a key and at least one value. Each value includes at least one sorted set, and each sorted set includes at least one element. Each element includes at least one field and the data value corresponding to each field. Multiple elements in each sorted set are sorted according to the data value corresponding to a preset field. It can be understood that in this embodiment, the value corresponding to the key in each key-value pair data is at least one sorted set. That is, a sorted set is stored using key-value storage. The key is the unique identifier of this sorted set, and the value is the sorted set itself. Each sorted set contains multiple elements, each including at least one field and the data value corresponding to each field. Multiple elements in each sorted set are sorted according to the data value corresponding to a preset field. Simply put, a key is the name of an ordered set, and the value corresponding to that key is the element (member) in that ordered set. For example, taking student exam score ranking as an example, the following is a score ranking table (which is an ordered set):

[0043] 1st place | Student a | 100;

[0044] 2nd place | Student b | 98;

[0045] 3rd place | Student c | 97;

[0046] 4th place | Student d | 95;

[0047] No. 5|Student e|94;

[0048] 6th place | Student f | 90.

[0049] Then, the target key-value pair data can be processed according to the data processing method corresponding to the target set operation type to obtain the data processing result corresponding to the data processing instruction. That is, the target key-value pair data is processed according to the data processing method corresponding to the target set operation type, and the processed data processing result is obtained. For example, the target set operation type is a sorted set operation that performs key-value operations, such as zadd, zcard, zrange, zrangebyscore, etc., which ensures fast and efficient key-value data storage and retrieval.

[0050] Step 3: Feed back the data processing results corresponding to each of the at least one data processing instruction to the client.

[0051] After obtaining the data processing results corresponding to at least one data processing instruction, the system can send the data processing results corresponding to at least one data processing instruction back to the client.

[0052] As can be seen from the above technical solution, the method provided by the present invention can be applied to solid-state drives corresponding to key-value databases. The method includes: receiving at least one data processing instruction sent by a client; wherein each data processing instruction includes: target set type data and target set operation type; performing parallel data processing on the at least one data processing instruction to obtain data processing results corresponding to each of the at least one data processing instruction; wherein, for each data processing instruction, determining target key-value pair data in the key-value database based on the target set type data, wherein each key-value pair data in the key-value database includes a key and at least one value, each value includes at least one ordered set, and each ordered set includes at least one element, wherein each element includes at least one field and data values ​​corresponding to each field, and multiple elements in each ordered set are sorted according to the data values ​​corresponding to preset fields; performing data processing on the target key-value pair data corresponding to the target set operation type to obtain data processing results corresponding to the data processing instruction; and feeding back the data processing results corresponding to each of the at least one data processing instruction to the client. In this application, key-value pairs in a key-value database can be processed in parallel according to at least one data processing instruction to obtain the data processing result corresponding to each of the at least one data processing instruction. The data processing result corresponding to each of the at least one data processing instruction is then fed back to the client. Therefore, this application can use preset data processing instructions to enable the client to efficiently connect to the key-value database and perform parallel data processing on the key-value pairs in the key-value database. This achieves efficient parallel data processing, thereby improving the performance of the application and the client, reducing operation latency, and ultimately improving the efficiency of data processing, reducing data processing costs, and improving the user experience of data processing.

[0053] Next, we will introduce examples for different target set data types and target set operation types.

[0054] In one implementation, the target set type data includes the key of the key-value pair to be processed, the target field, and the data value corresponding to the target field, and the target set operation type is a first add operation.

[0055] In this embodiment, the specific implementation of determining the target key-value pair data in the key-value database based on the target set type data can be as follows:

[0056] If the key, target field, and data value corresponding to the target field of the key-value pair to be processed all conform to their respective preset string types, the key of the key-value pair to be processed meets the preset threshold condition, and each target field has a corresponding data value, then a key-value pair class is generated using the key, target field, and data value corresponding to the target field of the key-value pair to be processed.

[0057] Determine whether key-value pair data corresponding to the key-value pair class exists in the key-value database; wherein the key in the key-value pair data is the same as the key of the key-value pair to be processed;

[0058] If the key-value pair data corresponding to the key-value pair class exists in the key-value database, the key-value pair data corresponding to the key-value pair class shall be used as the target key-value pair data.

[0059] If the key-value pair data corresponding to the key-value pair class does not exist in the key-value database, an empty key-value pair data is created in the key-value database, and the empty key-value pair data is used as the target key-value pair data.

[0060] Accordingly, the step of performing data processing on the target key-value pair data corresponding to the target set operation type to obtain the data processing result corresponding to the data processing instruction includes:

[0061] Convert the values ​​in the target key-value pair data into tree graph type data;

[0062] Insert the target field and its corresponding data value as an element into the treemap data to obtain the updated treemap data.

[0063] The updated tree graph data is converted into values ​​in the target key-value pair data;

[0064] The data processing result corresponding to the data processing instruction is determined to be that the element was added successfully, and the number of elements that were successfully added is taken as the data processing result corresponding to the data processing instruction.

[0065] Next, combine Figure 2 Provide examples. For instance... Figure 2As shown, the target set type data includes the key of the key-value pair to be processed, the target field in the target element member, and the data value corresponding to the target field (e.g., the score corresponding to the score). The target set operation type is the first addition operation zadd, which adds the specified member with the specified score to the sorted set stored at the key. If the member is already a member of the sorted set, the score will be updated, and the element will be re-inserted into the correct position to ensure sorting; if the key does not exist, a new sorted set will be created with the specified member as the only member. For example, it can be understood that an element has a standard (weight) for comparison. There are three people, Zhang San, Li Si, and Wang Wu. Zhang San's height is 160, Li Si's height is 180, and Wang Wu's height is 175. In the queue from tallest to shortest, height is the standard used for comparison. When the three people are queued in the order of Li Si, Wang Wu, and Zhang San, this queue is the sorted set, and the three people in the queue are the members of the sorted set. Specifically, it includes the following steps:

[0066] S101: Accept parameters

[0067] For step 101, three parameters are accepted: key, score, and member. The key is the key value corresponding to the sorted list to be stored. The score and member are the score and element of the sorted list. The sorted list will be sorted in ascending order of score. Multiple pairs of score and member are accepted.

[0068] S102: Determine if the parameter is even.

[0069] For step 102, determine whether the parameter is even. A score and a member are a pair. If they are, execute S103; otherwise, execute S115.

[0070] S103: Initialize a HetuItem using parameters.

[0071] For step 103, valid parameters will be passed here to initialize a HetuItem object.

[0072] S104: Initialize a TreeMap.

[0073] For step 104, TreeMap is a Java class used to perform operations such as adding and modifying data in a TreeMap within Java.

[0074] S105: Check if the key exists.

[0075] For step 105, the program will first determine whether the input key exists. If it exists, it will execute S106; otherwise, it will execute S107.

[0076] S106: Return the value corresponding to the key and decode it into a TreeMap.

[0077] For step 106, if a key exists, the value corresponding to the key will be retrieved from HetuKV. This value is stored as a ByteStream, so it needs to be converted into a TreeMap for easy manipulation in Java.

[0078] S107: Determine if the parameter is a Double or a String.

[0079] For step 107, Double and String correspond exactly to Score and Member, so it's necessary to check if the parameters are valid before proceeding with the next step. If valid, execute step S108; otherwise, execute step S115.

[0080] S108: Does the parameter to be added exist?

[0081] For step 108, check if the input parameter Member exists in the TreeMap obtained in step 106. If it does not exist, execute step S109; if it exists, execute step S110.

[0082] S109: Count +1.

[0083] For step 109, the number of new Members will be recorded.

[0084] S110: Store the input parameters into TreeMap.

[0085] For step 110, update the Score and Member in the TreeMap.

[0086] S111: Convert TreeMap to ByteStream.

[0087] For step 111, convert the TreeMap to a ByteStream.

[0088] S112: Set a new Value for HetuKVItem.

[0089] For step 112, update the Value of HetuKVItem.

[0090] S113: Determine if the update was successful.

[0091] For step 113, update the HetuKV object using the updated HetuItem. If the update is successful, execute S114; otherwise, execute S115.

[0092] S114: Return count.

[0093] For step 114, return the count of the new Member.

[0094] S115: Error code returned.

[0095] Step 115 is entered when S102, S107 and S113 fail, indicating that the operation has failed and cannot be performed. At this time, the corresponding error code will be returned and the operation will end.

[0096] For example, consider three people: Zhang San, Li Si, and Wang Wu. Zhang San is 160 cm tall, Li Si is 180 cm tall, and Wang Wu is 175 cm tall. In a queue from tallest to shortest, height is the standard used for comparison. The order of these three people in the queue is: Li Si, Wang Wu, Zhang San. This queue is an ordered set, and the three people in the queue are members of the ordered set.

[0097] In one implementation, the target set type data includes the keys of the key-value pairs to be processed, and the target set operation type is a first query operation.

[0098] In this embodiment, the specific implementation of determining the target key-value pair data in the key-value database based on the target set type data can be as follows:

[0099] If the key of the key-value pair to be processed conforms to a preset string type and the key of the key-value pair to be processed conforms to a preset threshold condition, then a key-value pair class is generated using the key of the key-value pair to be processed.

[0100] Determine whether key-value pair data corresponding to the key-value pair class exists in the key-value database; wherein the key in the key-value pair data is the same as the key of the key-value pair to be processed;

[0101] If the key-value pair data corresponding to the key-value pair class exists in the key-value database, the key-value pair data corresponding to the key-value pair class is used as the target key-value pair data.

[0102] Accordingly, the step of performing data processing on the target key-value pair data corresponding to the target set operation type to obtain the data processing result corresponding to the data processing instruction includes:

[0103] Convert the values ​​in the target key-value pair data into tree graph type data;

[0104] Determine the number of elements in the tree graph data;

[0105] The number of elements in the tree graph data is taken as the data processing result corresponding to the data processing instruction.

[0106] Next, combine Figure 3 Provide examples. For instance... Figure 3 As shown, the target set type data includes the key of the key-value pairs to be processed. The target set operation type is the first query operation zcard, which returns the number of elements in the sorted set. If the key does not exist, it returns 0, just like an empty sorted set. Specifically, it includes the following steps:

[0107] S201: Receive parameter: key.

[0108] For step 201, receive a parameter key. key is the key corresponding to the sorted list to be queried.

[0109] S202: Initialize a HetuItem using parameters.

[0110] For step 202, valid parameters will be passed here to initialize a HetuItem object.

[0111] S203: Initialize a TreeMap.

[0112] For step 203, TreeMap is a Java class used to perform operations such as adding and modifying data in a TreeMap within Java.

[0113] S204: Whether the value corresponding to the key was successfully returned.

[0114] For step 204, the program will first determine whether the query instruction was successfully executed. If successful, it will execute S205; otherwise, it will execute S207.

[0115] S205: Returns the value corresponding to the key and decodes it into a TreeMap.

[0116] For step 205, if a key exists, the value corresponding to the key will be retrieved from HetuKV. This value is stored as a ByteStream, so it needs to be converted into a corresponding TreeMap for easy manipulation in Java.

[0117] S206: Returns the length of the TreeMap.

[0118] For step 206, the length of the TreeMap will be returned, which is the number of elements in the sorted set.

[0119] S207: Determine if the error message is "Item Not Found".

[0120] For step 207, it will be further determined whether the error is due to the key not being found. If it is found, proceed to step S109; otherwise, proceed to step S108.

[0121] S208: Error code returned.

[0122] Step 208 is entered when S207 fails, indicating that the operation has failed and cannot be performed. At this time, the corresponding error code will be returned and the operation will end.

[0123] S209: Returns "0".

[0124] For step 209, if a new key that is not stored is entered, "0" will be returned.

[0125] In one implementation, the target set type data includes the key, the starting position of the element, and the ending position of the element for the key-value pairs to be processed, and the target set operation type is a second query operation.

[0126] In this embodiment, determining the target key-value pair data in the key-value database based on the target set type data includes:

[0127] If the key, the start position of the element, and the end position of the element of the key-value pair to be processed conform to a preset string type, and the key of the key-value pair to be processed meets a preset threshold condition, a key-value pair class is generated using the key, the start position of the element, and the end position of the element of the key-value pair to be processed.

[0128] Determine whether key-value pair data corresponding to the key-value pair class exists in the key-value database; wherein the key in the key-value pair data is the same as the key of the key-value pair to be processed;

[0129] If the key-value pair data corresponding to the key-value pair class exists in the key-value database, the key-value pair data corresponding to the key-value pair class is used as the target key-value pair data.

[0130] Accordingly, the step of performing data processing on the target key-value pair data corresponding to the target set operation type to obtain the data processing result corresponding to the data processing instruction includes:

[0131] Convert the values ​​in the target key-value pair data into tree graph type data;

[0132] Determine whether the sorting method of the elements in the tree graph data is the same as the sorting method corresponding to the starting position and the ending position of the element;

[0133] If the sorting method of the elements in the tree graph data is different from the sorting method corresponding to the starting position and the ending position of the elements, then the elements in the tree graph data are sorted in reverse order to obtain the adjusted tree graph data; if the sorting method of the elements in the tree graph data is the same as the sorting method corresponding to the starting position and the ending position of the elements, then the elements in the tree graph data are not adjusted.

[0134] Using a binary search method, based on the element's starting position and the element's ending position, determine the element corresponding to the element's starting position and the element corresponding to the element's ending position in the tree graph data; and use the elements corresponding to the element's starting position to the elements corresponding to the element's ending position as the target element set.

[0135] If the data values ​​corresponding to the preset fields in each element of the target element set are all integers, the data values ​​corresponding to the preset fields in each element of the target element set are used as the data processing results corresponding to the data processing instructions.

[0136] Next, combine Figure 4 Provide examples. For instance... Figure 4 As shown, the target set type data includes the key, start position, and stop position of the key-value pairs to be processed. The target set operation type is the second query operation zrange, which searches for values ​​in the sorted set within a given index range of the key / sorted set pair. Specifically, it includes the following steps:

[0137] S301: Receive parameters.

[0138] For step 301, three parameters are received: key, start, and stop. Here, key represents the key of the ordered set to be queried, start represents the starting value of the index range, and stop represents the ending value of the index range.

[0139] S302: Initialize HetuKVItem.

[0140] For step 302, valid parameters will be passed here to initialize a HetuItem object.

[0141] S303: Initialize a TreeMap.

[0142] For step 303, initialize a TreeMap to facilitate editing operations in Java.

[0143] S304: Check if HetuKVItem was successfully queried.

[0144] For step 304, use HetuKVItem to query HetuKV based on its key and determine if the query was successful. If successful, proceed to step S305; otherwise, proceed to step S320.

[0145] S305: Returns the value corresponding to the key and decodes it into a TreeMap.

[0146] For step 305, return the value and decode it into a TreeMap type.

[0147] S306: Extract and initialize input parameters.

[0148] For step 306, initialize the input parameters.

[0149] S307: Iterate through all input parameters.

[0150] For step 307, iterate through all the input parameters and determine whether to end the iteration.

[0151] S308: Determine if it is a String.

[0152] For step 308, determine whether the input parameter is a String. If it is, execute S313; otherwise, execute S318.

[0153] S309: Determine whether "REV" is included.

[0154] For step 309, determine whether the input parameter is REV. If it is, execute S310; otherwise, execute S307.

[0155] S310: Sort all data in reverse order.

[0156] For step 310, if “REV” appears, then all data are sorted in reverse order.

[0157] S311: Apply binary search to the range boundary.

[0158] For step 311, apply a binary search to the range boundary.

[0159] S312: Returns the elements within the specified range.

[0160] For step 312, return the sorted set of values ​​for the given score range.

[0161] S313: Whether "LIMIT" is included.

[0162] For step 313, determine whether the input parameter is LIMIT. If it is, execute S314; otherwise, execute S307.

[0163] S314: Returns a sublist within a specified range.

[0164] For step 314, if LIMIT is encountered, a sublist of the specified range will be returned.

[0165] S315: Determine whether "WITHSCORES" is included.

[0166] For step 315, determine whether the input parameter is WITHSCORES. If it is, execute S316; otherwise, execute S317.

[0167] S316: Returns a list and a score.

[0168] For step 316, if WITHSCORES occurs, return both the value and the score.

[0169] S317: Return the list.

[0170] For step 317, if WITHSCORES does not appear, only the value is returned.

[0171] S318: Is it an Integer?

[0172] For step 318, determine if it is an integer type. If it is, execute S319; otherwise, execute S311.

[0173] S319: Add integer to limitnumber.

[0174] For step 319, if it is an integer type, then add this integer type to the limitnumber variable.

[0175] S320: Returns an error code.

[0176] Step 320 is entered when S304 fails, indicating that the operation has failed and cannot be performed. At this time, the corresponding error code will be returned and the operation will end.

[0177] For example, taking student exam score ranking as an example, the following is a score ranking table (that is, an ordered set):

[0178] 1st place | Student a | 100;

[0179] 2nd place | Student b | 98;

[0180] 3rd place | Student c | 97;

[0181] 4th place | Student d | 95;

[0182] No. 5|Student e|94;

[0183] 6th place | Student f | 90;

[0184] To find the students ranked 2nd to 5th (that is, to find the elements in the sorted set with indices 1 to 4 {indices start from 0}), the search result is: [b, c, d, e].

[0185] In one implementation, the target set type data includes the key of the key-value pair to be processed, the target field, the starting position of the data value corresponding to the target field, and the ending position of the data value, and the target set operation type is a third query operation.

[0186] In this embodiment, determining the target key-value pair data in the key-value database based on the target set type data includes:

[0187] If the key, target field, start position of the data value corresponding to the target field, and end position of the data value of the key-value pair to be processed all conform to their respective preset string types, and the key of the key-value pair to be processed meets the preset threshold condition, a key-value pair class is generated using the key, start position of the element, and end position of the element of the key-value pair to be processed.

[0188] Determine whether key-value pair data corresponding to the key-value pair class exists in the key-value database; wherein the key in the key-value pair data is the same as the key of the key-value pair to be processed;

[0189] If the key-value pair data corresponding to the key-value pair class exists in the key-value database, the key-value pair data corresponding to the key-value pair class is used as the target key-value pair data.

[0190] Accordingly, the step of performing data processing on the target key-value pair data corresponding to the target set operation type to obtain the data processing result corresponding to the data processing instruction includes:

[0191] Convert the values ​​in the target key-value pair data into tree graph type data;

[0192] Determine whether the sorting method of the elements in the tree graph data is the same as the sorting method corresponding to the start position and end position of the data value of the target field;

[0193] If the sorting method of the elements in the tree graph data is different from the sorting method corresponding to the start and end positions of the data values ​​of the target field, then the elements in the tree graph data are sorted in reverse order to obtain the adjusted tree graph data; if the sorting method of the elements in the tree graph data is the same as the sorting method corresponding to the start and end positions of the data values ​​of the target field, then the elements in the tree graph data are not adjusted.

[0194] Using a binary search method, based on the target field, the starting position of the data value corresponding to the target field, and the ending position of the data value corresponding to the target field, the target element in the tree graph data whose data value of the target field is greater than or equal to the starting position of the data value corresponding to the target field and less than or equal to the ending position of the data value corresponding to the target field is determined;

[0195] If all data values ​​corresponding to the target fields in the target element are integers, the data values ​​corresponding to the preset fields in the target element will be used as the data processing results corresponding to the data processing instructions.

[0196] Next, combine Figure 5 Provide examples. For instance... Figure 5 As shown, the target set type data includes the key of the key-value pair to be processed, the target field, the starting position (min) and ending position (max) of the data value corresponding to the target field, and the target set operation type is the third query operation zrangebyscore, that is, finding the sorted set values ​​within a given score range in the key / sorted set pair. The target field can be a score, which can be understood as the weight of the element, and the index can be understood as the position of the element in the list. Taking student exam score ranking as an example, the following is a score ranking table (that is, an ordered set):

[0197] 1st Place | Student A | 100

[0198] 2nd Place | Student b | 98

[0199] 3rd place | Student c | 97

[0200] 4th place | Student d | 95

[0201] No. 5|Student e|94

[0202] The 6th ranked student | student f | 90; The third query operation, zrangebyscore, searches for students with scores between 90 and 96, and the search results are [d, e, f]. Specifically, it includes the following steps:

[0203] S401: Receive parameters.

[0204] For step 401, five parameters are received: key, min, max, offset, and count. Here, key represents the key of the sorted set to be queried, min represents the starting value of the score range, max represents the ending value of the score range, offset represents the initial value of the index limiting the number of sorted sets, and count represents the limit value of the sorted set.

[0205] S402: Initialize HetuKVItem.

[0206] For step 402, valid parameters will be passed here to initialize a HetuItem object.

[0207] S403: Initialize a TreeMap.

[0208] For step 403, initialize a TreeMap to facilitate editing operations in Java.

[0209] S404: Check if HetuKVItem was successfully queried.

[0210] For step 404, use HetuKVItem to query HetuKV based on its key and determine whether the query was successful. If successful, proceed to step S405; otherwise, proceed to step S420.

[0211] S405: Returns the value corresponding to the key and decodes it into a TreeMap.

[0212] For step 405, return the value and decode it into a TreeMap type.

[0213] S406: Extract and initialize input parameters.

[0214] For step 406, initialize the input parameters.

[0215] S407: Iterate through all input parameters.

[0216] For step 407, iterate through all the input parameters and determine whether to end the iteration.

[0217] S408: Determine if it is a String.

[0218] For step 408, determine whether the input parameter is a String. If it is, execute S413; otherwise, execute S418.

[0219] S409: Determine if "REV" is included.

[0220] For step 409, determine whether the input parameter is REV. If it is, execute S410; otherwise, execute S407.

[0221] S410: Sort all data in reverse order.

[0222] For step 410, if “REV” appears, then all data are sorted in reverse order.

[0223] S411: Apply binary search to the range boundary.

[0224] For step 411, apply a binary search to the range boundary.

[0225] S412: Returns the elements within the specified range.

[0226] For step 412, return the sorted set of values ​​for the given score range.

[0227] S413: Determine if "LIMIT" is contained.

[0228] For step 413, determine whether the input parameter is LIMIT. If it is, execute S414; otherwise, execute S407.

[0229] S414: Returns a sublist within a specified range.

[0230] For step 414, if LIMIT is encountered, a sublist of the specified range will be returned.

[0231] S415: Determine whether "WITHSCORES" is included.

[0232] For step 415, determine whether the input parameter is WITHSCORES. If it is, execute S416; otherwise, execute S417.

[0233] S416: Returns a list and a score.

[0234] For step 416, if WITHSCORES occurs, both the value and the score are returned.

[0235] S417: Return the list.

[0236] For step 417, if WITHSCORES does not appear, only the value is returned.

[0237] S418: Is it an Integer?

[0238] For step 418, determine whether it is an integer type. If it is, execute S419; otherwise, execute S411.

[0239] S419: Add integer to limitnumber.

[0240] For step 419, if it is an integer type, then add this integer type to the limitnumber variable.

[0241] S420: Error code returned.

[0242] Step 420 is entered when S404 fails, indicating that the operation has failed and cannot be performed. At this time, the corresponding error code will be returned and the operation will end.

[0243] In one implementation, the target set type data includes the key of the key-value pair to be processed, the target field, the starting position of the data value corresponding to the target field, and the ending position of the data value. The target set operation type is a fourth query operation.

[0244] In this embodiment, determining the target key-value pair data in the key-value database based on the target set type data includes:

[0245] If the key, target field, start position of the data value corresponding to the target field, and end position of the data value of the key-value pair to be processed all conform to their respective preset string types, and the key of the key-value pair to be processed meets the preset threshold condition, a key-value pair class is generated using the key, start position of the element, and end position of the element of the key-value pair to be processed.

[0246] Determine whether key-value pair data corresponding to the key-value pair class exists in the key-value database; wherein the key in the key-value pair data is the same as the key of the key-value pair to be processed;

[0247] If the key-value pair data corresponding to the key-value pair class exists in the key-value database, the key-value pair data corresponding to the key-value pair class is used as the target key-value pair data.

[0248] Accordingly, the step of performing data processing on the target key-value pair data corresponding to the target set operation type to obtain the data processing result corresponding to the data processing instruction includes:

[0249] Convert the values ​​in the target key-value pair data into tree graph type data;

[0250] Determine whether the sorting method of the elements in the tree graph data is the same as the sorting method corresponding to the start position and end position of the data value of the target field;

[0251] If the sorting method of the elements in the tree graph data is different from the sorting method corresponding to the start and end positions of the data values ​​of the target field, then the elements in the tree graph data are sorted in reverse order to obtain the adjusted tree graph data; if the sorting method of the elements in the tree graph data is the same as the sorting method corresponding to the start and end positions of the data values ​​of the target field, then the elements in the tree graph data are not adjusted.

[0252] Using a binary search method, based on the target field, the starting position of the data value corresponding to the target field, and the ending position of the data value corresponding to the target field, the target element in the tree graph data whose data value of the target field is greater than or equal to the starting position of the data value corresponding to the target field and less than or equal to the ending position of the data value corresponding to the target field is determined;

[0253] The number of target elements is taken as the data processing result corresponding to the data processing instruction.

[0254] Next, combine Figure 6 Provide examples. For instance... Figure 6 As shown, the target set type data includes the key of the key-value pair to be processed, the target field, the start position of the data value corresponding to the target field, and the end position of the data value. The target set operation type is the fourth query operation zcount, which checks the size of the sorted set within a given score range in the key / sorted set pair. Taking student exam score ranking as an example, the following is a score ranking table (that is, an ordered set):

[0255] 1st Place | Student A | 100

[0256] 2nd Place | Student b | 98

[0257] 3rd place | Student c | 97

[0258] 4th place | Student d | 95

[0259] No. 5|Student e|94

[0260] The 6th ranked student | f | 90; the fourth query operation zcount is to find the number of students with scores between 90 and 96. The result is 3. Specifically, it includes the following steps:

[0261] S501: Receive parameters.

[0262] For step 501, three parameters are received: key, start, and end. Here, key represents the key of the ordered set to be queried, start represents the starting value of the score range, and end represents the ending value of the score range.

[0263] S502: Initialize HetuKVItem.

[0264] For step 502, valid parameters will be passed here to initialize a HetuItem object.

[0265] S503: Set the key for HetuKVItem.

[0266] For step 503, set the input parameter to the key of HetuKVItem.

[0267] S504: Check if the query was successful.

[0268] For step 504, use HetuKVItem to query HetuKV based on its key and determine if the query was successful. If successful, proceed to step S505; otherwise, proceed to step S507.

[0269] S505: If the input is of type double.

[0270] For step 505, determine if the input is of type double. If yes, execute S506; otherwise, execute S508.

[0271] S506: Returns the length of the set.

[0272] For step 506, return the length of the set.

[0273] S507: Error code returned.

[0274] Step 507 is entered when S504 fails, indicating that the operation has failed and cannot be performed. At this time, the corresponding error code will be returned and the operation will end.

[0275] S508: If the input is of type String.

[0276] For step 508, determine if the input is of type String. If it is, execute S509; otherwise, execute S510.

[0277] S509: Returns the length of the set.

[0278] For step 509, return the length of the set.

[0279] S510: Returns "0".

[0280] For step 510, if it is neither a String nor a Double type, return 0.

[0281] In one implementation, the target set type data includes the key of the key-value pair to be processed, the target field, and the position of the target element, and the target set operation type is a fifth query operation.

[0282] In this embodiment, determining the target key-value pair data in the key-value database based on the target set type data includes:

[0283] If the key, target field, start position of the data value corresponding to the target field, and end position of the data value of the key-value pair to be processed all conform to their respective preset string types, and the key of the key-value pair to be processed meets the preset threshold condition, a key-value pair class is generated using the key, start position of the element, and end position of the element of the key-value pair to be processed.

[0284] Determine whether key-value pair data corresponding to the key-value pair class exists in the key-value database; wherein the key in the key-value pair data is the same as the key of the key-value pair to be processed;

[0285] If the key-value pair data corresponding to the key-value pair class exists in the key-value database, the key-value pair data corresponding to the key-value pair class is used as the target key-value pair data.

[0286] Accordingly, the step of performing data processing on the target key-value pair data corresponding to the target set operation type to obtain the data processing result corresponding to the data processing instruction includes:

[0287] Convert the values ​​in the target key-value pair data into tree graph type data;

[0288] Based on the position of the target element, determine the target element corresponding to the position of the target element from the tree graph data;

[0289] The data value corresponding to the target field in the target element is used as the data processing result corresponding to the data processing instruction.

[0290] Next, combine Figure 7 Provide examples. For instance... Figure 7 As shown, the target set type data includes the key (key), target field, and target element position (member) of the key-value pairs to be processed. The target set operation type is the fifth query operation, zscore, which returns the score of the specified element in the sorted set at the key position. If the specified element does not exist in the sorted set, or the key does not exist at all, a special "empty" value will be returned. Taking student exam score ranking as an example, the following is a score ranking table (that is, an ordered set):

[0291] 1st Place | Student A | 100

[0292] 2nd Place | Student b | 98

[0293] 3rd place | Student c | 97

[0294] 4th place | Student d | 95

[0295] No. 5|Student e|94

[0296] 6th place | Student f | 90; The fifth query operation zscore is to find the score of student a, and the search result is: 100. The search result for student H's score is: Null. Specifically, it includes the following steps:

[0297] S601: Receive parameters.

[0298] For step 601, two parameters are received: key and member. Key represents the key of the ordered set to be queried, and member represents the target member.

[0299] S602: Initialize HetuKVItem.

[0300] For step 602, valid parameters will be passed here to initialize a HetuItem object.

[0301] S603: Set the key for HetuKVItem.

[0302] For step 603, set the input parameter to the key of HetuKVItem.

[0303] S604: Check if the query was successful.

[0304] For step 604, use HetuKVItem to query HetuKV based on its key and determine if the query was successful. If successful, proceed to step S605; otherwise, proceed to step S606.

[0305] S605: Returns the member's score.

[0306] For step 605, if the query is successful, the score corresponding to the member is returned directly.

[0307] S606: If item does not exist.

[0308] For step 606, determine if the item exists. If it exists, proceed to step S608; otherwise, proceed to step S607.

[0309] S607: Return Null.

[0310] For step 607, if item does not exist, return null.

[0311] S608: Error code returned.

[0312] Step 608 is entered when S606 fails, indicating that the operation has failed and cannot be performed. At this time, the corresponding error code will be returned and the operation will end.

[0313] In one implementation, the target set type data includes the key of the key-value pair to be processed and the position of the target element, and the target set operation type is a deletion operation.

[0314] In this embodiment, determining the target key-value pair data in the key-value database based on the target set type data includes:

[0315] If the key and target fields of the key-value pair to be processed both conform to their respective preset string types, and the key of the key-value pair to be processed meets the preset threshold condition, a key-value pair class is generated using the key and target fields of the key-value pair to be processed.

[0316] Determine whether key-value pair data corresponding to the key-value pair class exists in the key-value database; wherein the key in the key-value pair data is the same as the key of the key-value pair to be processed;

[0317] If the key-value pair data corresponding to the key-value pair class exists in the key-value database, the key-value pair data corresponding to the key-value pair class is used as the target key-value pair data.

[0318] Accordingly, the step of performing data processing on the target key-value pair data corresponding to the target set operation type to obtain the data processing result corresponding to the data processing instruction includes:

[0319] Convert the values ​​in the target key-value pair data into tree graph type data;

[0320] Delete the target element corresponding to the position of the target element in the tree graph data;

[0321] The number of target elements successfully deleted is taken as the data processing result corresponding to the data processing instruction.

[0322] Next, combine Figure 8 Provide examples. For instance... Figure 8 As shown, the target set type data includes the key (key) of the key-value pairs to be processed and the position (member) of the target element. The target set operation type is a deletion operation (zrem), that is, deleting the specified member from the sorted set value stored at the key. If the member is not in the set, no operation is performed; if the key does not contain the set value, an error message is returned. Taking student exam score ranking as an example, the following is a score ranking table (i.e., an ordered set):

[0323] 1st Place | Student A | 100

[0324] 2nd Place | Student b | 98

[0325] 3rd place | Student c | 97

[0326] 4th place | Student d | 95

[0327] No. 5|Student e|94

[0328] 6th place | Student f | 90;

[0329] The delete operation `zrem` reorders the records for student 'b' to be deleted, resulting in a new ranking table after the operation.

[0330] 1st Place | Student A | 100

[0331] 2nd Place | Student C | 97

[0332] 3rd place | Student d | 95

[0333] No. 4|Student e|94

[0334] 5th place | Student f | 90. Specifically, it includes the following steps:

[0335] S701: Receive parameters.

[0336] For step 701, two parameters are received: key and member. Key represents the key of the ordered set to be queried, and member represents the target member.

[0337] S702: Initialize HetuKVItem.

[0338] For step 702, valid parameters will be passed here to initialize a HetuItem object.

[0339] S703: Set the key for HetuKVItem.

[0340] For step 703, set the input parameter to the key of HetuKVItem.

[0341] S704: Check if the query was successful.

[0342] For step 704, use HetuKVItem to query HetuKV based on its key and determine whether the query was successful. If successful, proceed to step S705; otherwise, proceed to step S712.

[0343] S705: Set the count to 0.

[0344] For step 705, initialize the count to 0.

[0345] S706: Iterate through all objects to be deleted.

[0346] For step 706, determine whether all objects to be deleted have been traversed. If yes, execute S710; otherwise, execute S707.

[0347] S707: If the treeMap contains objects.

[0348] For step 707, if the Treemap contains objects to be deleted, then execute S708; otherwise, execute S706.

[0349] S708: Delete object.

[0350] For step 708, delete the object in the Treemap.

[0351] S709: Count +1.

[0352] For step 709, record the number of objects deleted.

[0353] S710: Update Treemap to HetuKV.

[0354] For step 710, update the completed Treemap to HetuKV.

[0355] S711: Return count.

[0356] For step 711, return the count.

[0357] S712: Returns an error code.

[0358] Step 712 is entered when S704 fails, indicating that the operation has failed and cannot be performed. At this time, the corresponding error code will be returned and the operation will end.

[0359] In one implementation, the target set type data includes the key of the key-value pair to be processed, the target field, the starting position and ending position of the data value corresponding to the target field, the starting position of the index, and the number of index elements. The target set operation type is the sixth query operation.

[0360] In this embodiment, determining the target key-value pair data in the key-value database based on the target set type data includes:

[0361] If the key, target field, starting position and ending position of the data value corresponding to the target field, starting position of the index, and number of index elements of the key-value pair to be processed all conform to their respective preset string types, and the key of the key-value pair to be processed meets the preset threshold condition, a key-value pair class is generated using the key, target field, starting position and ending position of the data value corresponding to the target field, starting position of the index, and number of index elements;

[0362] Determine whether key-value pair data corresponding to the key-value pair class exists in the key-value database; wherein the key in the key-value pair data is the same as the key of the key-value pair to be processed;

[0363] If the key-value pair data corresponding to the key-value pair class exists in the key-value database, the key-value pair data corresponding to the key-value pair class is used as the target key-value pair data.

[0364] Accordingly, the step of performing data processing on the target key-value pair data corresponding to the target set operation type to obtain the data processing result corresponding to the data processing instruction includes:

[0365] Convert the values ​​in the target key-value pair data into tree graph type data;

[0366] Determine whether the sorting method of the elements in the tree graph data is the same as the sorting method corresponding to the start position and end position of the data value of the target field;

[0367] If the sorting method of the elements in the tree graph data is different from the sorting method corresponding to the start and end positions of the data values ​​of the target field, then the elements in the tree graph data are sorted in reverse order to obtain the adjusted tree graph data; if the sorting method of the elements in the tree graph data is the same as the sorting method corresponding to the start and end positions of the data values ​​of the target field, then the elements in the tree graph data are not adjusted.

[0368] Using a binary search method, a set of target elements is determined in the tree graph data based on the target field, the starting position of the data value corresponding to the target field, and the ending position of the data value corresponding to the target field. The data value of the target field of each target element in the set of target elements is greater than or equal to the starting position of the data value corresponding to the target field and less than or equal to the ending position of the data value corresponding to the target field.

[0369] If the data values ​​corresponding to the target fields in the target elements are all integers, the target element in the target element set corresponding to the starting position of the index is taken as the starting point, the number of target elements of the index elements is determined, and the number of target elements of the index elements is taken as the data processing result corresponding to the data processing instruction.

[0370] Next, combine Figure 9 Provide examples. For instance... Figure 9 As shown, the target set type data includes the key of the key-value pair to be processed, the target field, the starting position (min) and ending position (max) of the data value corresponding to the target field, the starting position (offset) of the index, and the number of index elements (count). The target set operation type is the sixth query operation, zrangebylex, which searches for values ​​in the sorted set of a given part-of-speech range within the key / sorted set pair. For example, given an ordered set [a, b, c, d, e, f, g], a subset [b, c, d, e, f] is selected based on the scores (min and max). The offset represents the index position of this subset, and the count represents the number of elements to search from this index position. For example: offset = 0, count = 2, the search result is [b, c]; offset = 1, count = 1, the search result is [c]; offset = 1, count = 2, the search result is [c, d]; offset = 2, count = 3, the search result is [d, e, f]; offset = 2, count = 5, the search result is [d, e, f]. Specifically, it includes the following steps:

[0371] S801: Receive parameters.

[0372] For step 801, `key` is the target key, `min` is the starting value of the score range, `max` is the ending value of the score range, `offset` is the initial value of the sorted set limit index, and `count` is the sorted set limit value. Its function is to find the sorted set value within a given score range in the key / sorted set pair. `min`, `max`, `offset`, and `count` are all used to limit the search range. `min` and `max` represent the minimum and maximum values ​​of the closed interval, used for an initial search within the sorted set to obtain a subset of the sorted set. `offset` and `count` are used for further searching within this subset of the sorted set.

[0373] S802: Initialize HetuKVItem.

[0374] For step 802, valid parameters will be passed here to initialize a HetuItem object.

[0375] S803: Initialize a TreeMap.

[0376] For step 803, initialize a TreeMap to facilitate editing operations in Java.

[0377] S804: Check if HetuKVItem was successfully queried.

[0378] For step 804, use HetuKVItem to query HetuKV based on its key and determine whether the query was successful. If successful, proceed to S805; otherwise, proceed to S820.

[0379] S805: Returns the value corresponding to the key and decodes it into a TreeMap.

[0380] For step 805, return the value and decode it into a TreeMap type.

[0381] S806: Extract and initialize input parameters.

[0382] For step 806, initialize the input parameters.

[0383] S807: Iterate through all input parameters.

[0384] For step 807, iterate through all the input parameters and determine whether to end the iteration.

[0385] S808: Determine if it is a String.

[0386] For step 808, determine whether the input parameter is a String. If it is, execute S813; otherwise, execute S818.

[0387] S809: Determine if "REV" appears.

[0388] For step 809, determine whether the input parameter is REV. If it is, execute S810; otherwise, execute S807.

[0389] S810: Sort all data in reverse order.

[0390] For step 810, if “REV” appears, then all data are sorted in reverse order.

[0391] S811: Apply binary search to the range boundary.

[0392] For step 811, apply a binary search to the range boundary.

[0393] S812: Returns the elements within the specified range.

[0394] For step 812, return the sorted set of values ​​for the given score range.

[0395] S813: Whether "LIMIT" appears.

[0396] For step 813, determine whether the input parameter is LIMIT. If it is, execute S814; otherwise, execute S807.

[0397] S814: Returns a sublist within a specified range.

[0398] For step 814, if LIMIT is encountered, a sublist of the specified range will be returned.

[0399] S815: Determine if "WITHSCORES" appears.

[0400] For step 815, determine whether the input parameter is WITHSCORES. If it is, execute S816; otherwise, execute S817.

[0401] S816: Returns a list and a score.

[0402] For step 816, if WITHSCORES occurs, return both the value and the score.

[0403] S817: Return the list.

[0404] For step 817, if WITHSCORES does not appear, only the value is returned.

[0405] S818: Is it an Integer?

[0406] For step 818, determine whether it is an integer type. If it is, execute S819; otherwise, execute S811.

[0407] S819: Add integer to limitnumber.

[0408] For step 819, if it is an integer type, then add this integer type to the limitnumber variable.

[0409] S820: Returns an error code.

[0410] Step 820 is entered when S804 fails, indicating that the operation has failed and cannot be performed. At this time, the corresponding error code will be returned and the operation will end.

[0411] In one embodiment, prior to the step of receiving at least one data processing instruction sent by the client, the method further includes:

[0412] Receive a call instruction sent by the client; wherein the call instruction includes a target solid-state drive identifier;

[0413] The solid-state drive (SSD) corresponding to the target SSD identifier is invoked according to the target SSD identifier, and the SSD corresponding to the target SSD identifier is used as the SSD corresponding to the key-value database, and the state of the SSD corresponding to the key-value database is adjusted to a locked state.

[0414] Accordingly, after the step of feeding back the data processing results corresponding to each of the at least one data processing instruction to the client, the method further includes:

[0415] Release the memory of the solid-state drive corresponding to the key-value database, and adjust the state of the solid-state drive corresponding to the key-value database to an idle state.

[0416] As an example, when using a Java client to call the HetuKV key-value database, a specific solid-state drive (SSD) is specified and locked. This lock is released after the call ends, leveraging HetuKV's garbage collection mechanism to promptly release the memory occupied by the SSD. During the SSD locking process, other processes cannot use the SSD. Furthermore, in this embodiment, offloading data computation to the SSD reduces memory dependency and optimizes resource utilization through garbage collection. Locking the SSD ensures data security and reliability, thereby achieving resource optimization and security assurance. This leverages HetuKV's advantages to optimize resource utilization, ensure data security and reliability, reduce memory dependency, optimize hardware resource utilization, lower memory consumption, and make the system more resilient. Additionally, it enhances security and control, providing complete control and strengthening data security, ensuring data security for enterprise applications.

[0417] Thus, this embodiment, combined with a specific application scenario, implements the data processing method's processing procedure. It should be noted that the above scenario is merely exemplary and does not constitute a limitation on the method provided by this invention. The method provided by this invention can be extended to other data processing methods based on the same principles.

[0418] like Figure 10 The image shows a specific embodiment of the data processing apparatus described in this application. The apparatus described in this embodiment is a physical device used to execute the method described in the above embodiments. Its technical solution is essentially the same as that of the above embodiments, and the corresponding descriptions in the above embodiments are also applicable to this embodiment. In this embodiment, the apparatus is applied to a solid-state drive corresponding to a key-value database. The apparatus includes:

[0419] The first unit 1001 is used to receive at least one data processing instruction sent by the client; wherein each data processing instruction includes: target set type data and target set operation type;

[0420] The second unit 1002 is used to perform parallel data processing on the at least one data processing instruction to obtain data processing results corresponding to each of the at least one data processing instruction; wherein, for each data processing instruction, target key-value pair data in the key-value database is determined according to the target set type data, wherein each key-value pair data in the key-value database includes a key and at least one value, each value includes at least one ordered set, and each ordered set includes at least one element, wherein each element includes at least one field and data values ​​corresponding to each field, and multiple elements in each ordered set are sorted according to the data values ​​corresponding to preset fields; data processing corresponding to the target set operation type is performed on the target key-value pair data to obtain the data processing result corresponding to the data processing instruction;

[0421] The third unit 1003 is used to feed back the data processing results corresponding to each of the at least one data processing instruction to the client.

[0422] Optionally, the target set type data includes the key of the key-value pair to be processed, the target field, and the data value corresponding to the target field, and the target set operation type is a first add operation.

[0423] Optionally, the second unit 1002 is used for:

[0424] If the key, target field, and data value corresponding to the target field of the key-value pair to be processed all conform to their respective preset string types, the key of the key-value pair to be processed meets the preset threshold condition, and each target field has a corresponding data value, then a key-value pair class is generated using the key, target field, and data value corresponding to the target field of the key-value pair to be processed.

[0425] Determine whether key-value pair data corresponding to the key-value pair class exists in the key-value database; wherein the key in the key-value pair data is the same as the key of the key-value pair to be processed;

[0426] If the key-value pair data corresponding to the key-value pair class exists in the key-value database, the key-value pair data corresponding to the key-value pair class shall be used as the target key-value pair data.

[0427] If the key-value pair data corresponding to the key-value pair class does not exist in the key-value database, an empty key-value pair data is created in the key-value database, and the empty key-value pair data is used as the target key-value pair data.

[0428] Optionally, the second unit 1002 is used for:

[0429] Convert the values ​​in the target key-value pair data into tree graph type data;

[0430] Insert the target field and its corresponding data value as an element into the tree graph data to obtain the updated tree graph data.

[0431] The updated tree graph data is converted into values ​​in the target key-value pair data;

[0432] The data processing result corresponding to the data processing instruction is determined to be that the element was added successfully, and the number of elements that were successfully added is taken as the data processing result corresponding to the data processing instruction.

[0433] Optionally, the target set type data includes the key of the key-value pair to be processed, and the target set operation type is a first query operation.

[0434] Optionally, the second unit 1002 is used for:

[0435] If the key of the key-value pair to be processed conforms to a preset string type and the key of the key-value pair to be processed conforms to a preset threshold condition, then a key-value pair class is generated using the key of the key-value pair to be processed.

[0436] Determine whether key-value pair data corresponding to the key-value pair class exists in the key-value database; wherein the key in the key-value pair data is the same as the key of the key-value pair to be processed;

[0437] If the key-value pair data corresponding to the key-value pair class exists in the key-value database, the key-value pair data corresponding to the key-value pair class is used as the target key-value pair data.

[0438] Optionally, the second unit 1002 is used for:

[0439] Convert the values ​​in the target key-value pair data into tree graph type data;

[0440] Determine the number of elements in the tree graph data;

[0441] The number of elements in the tree graph data is taken as the data processing result corresponding to the data processing instruction.

[0442] Optionally, the target set type data includes the key, element start position, and element end position of the key-value pair to be processed, and the target set operation type is a second query operation.

[0443] Optionally, the second unit 1002 is used for:

[0444] If the key, the start position of the element, and the end position of the element of the key-value pair to be processed conform to a preset string type, and the key of the key-value pair to be processed meets a preset threshold condition, a key-value pair class is generated using the key, the start position of the element, and the end position of the element of the key-value pair to be processed.

[0445] Determine whether key-value pair data corresponding to the key-value pair class exists in the key-value database; wherein the key in the key-value pair data is the same as the key of the key-value pair to be processed;

[0446] If the key-value pair data corresponding to the key-value pair class exists in the key-value database, the key-value pair data corresponding to the key-value pair class is used as the target key-value pair data.

[0447] Optionally, the second unit 1002 is used for:

[0448] Convert the values ​​in the target key-value pair data into tree graph type data;

[0449] Determine whether the sorting method of the elements in the tree graph data is the same as the sorting method corresponding to the starting position and the ending position of the element;

[0450] If the sorting method of the elements in the tree graph data is different from the sorting method corresponding to the starting position and the ending position of the elements, then the elements in the tree graph data are sorted in reverse order to obtain the adjusted tree graph data; if the sorting method of the elements in the tree graph data is the same as the sorting method corresponding to the starting position and the ending position of the elements, then the elements in the tree graph data are not adjusted.

[0451] Using a binary search method, based on the element's starting position and the element's ending position, determine the element corresponding to the element's starting position and the element corresponding to the element's ending position in the tree graph data; and use the elements corresponding to the element's starting position to the elements corresponding to the element's ending position as the target element set.

[0452] If the data values ​​corresponding to the preset fields in each element of the target element set are all integers, the data values ​​corresponding to the preset fields in each element of the target element set are used as the data processing results corresponding to the data processing instructions.

[0453] Optionally, the target set type data includes the key of the key-value pair to be processed, the target field, the start position of the data value corresponding to the target field, and the end position of the data value, and the target set operation type is a third query operation.

[0454] Optionally, the second unit 1002 is used for:

[0455] If the key, target field, start position of the data value corresponding to the target field, and end position of the data value of the key-value pair to be processed all conform to their respective preset string types, and the key of the key-value pair to be processed meets the preset threshold condition, a key-value pair class is generated using the key, start position of the element, and end position of the element of the key-value pair to be processed.

[0456] Determine whether key-value pair data corresponding to the key-value pair class exists in the key-value database; wherein the key in the key-value pair data is the same as the key of the key-value pair to be processed;

[0457] If the key-value pair data corresponding to the key-value pair class exists in the key-value database, the key-value pair data corresponding to the key-value pair class is used as the target key-value pair data.

[0458] Optionally, the second unit 1002 is used for:

[0459] Convert the values ​​in the target key-value pair data into tree graph type data;

[0460] Determine whether the sorting method of the elements in the tree graph data is the same as the sorting method corresponding to the start position and end position of the data value of the target field;

[0461] If the sorting method of the elements in the tree graph data is different from the sorting method corresponding to the start and end positions of the data values ​​of the target field, then the elements in the tree graph data are sorted in reverse order to obtain the adjusted tree graph data; if the sorting method of the elements in the tree graph data is the same as the sorting method corresponding to the start and end positions of the data values ​​of the target field, then the elements in the tree graph data are not adjusted.

[0462] Using a binary search method, based on the target field, the starting position of the data value corresponding to the target field, and the ending position of the data value corresponding to the target field, the target element in the tree graph data whose data value of the target field is greater than or equal to the starting position of the data value corresponding to the target field and less than or equal to the ending position of the data value corresponding to the target field is determined;

[0463] If all data values ​​corresponding to the target fields in the target element are integers, the data values ​​corresponding to the preset fields in the target element will be used as the data processing results corresponding to the data processing instructions.

[0464] Optionally, the target set type data includes the key of the key-value pair to be processed, the target field, the starting position of the data value corresponding to the target field, and the ending position of the data value, and the target set operation type is the fourth query operation.

[0465] Optionally, the second unit 1002 is used for:

[0466] If the key, target field, start position of the data value corresponding to the target field, and end position of the data value of the key-value pair to be processed all conform to their respective preset string types, and the key of the key-value pair to be processed meets the preset threshold condition, a key-value pair class is generated using the key, start position of the element, and end position of the element of the key-value pair to be processed.

[0467] Determine whether key-value pair data corresponding to the key-value pair class exists in the key-value database; wherein the key in the key-value pair data is the same as the key of the key-value pair to be processed;

[0468] If the key-value pair data corresponding to the key-value pair class exists in the key-value database, the key-value pair data corresponding to the key-value pair class is used as the target key-value pair data.

[0469] Optionally, the second unit 1002 is used for:

[0470] Convert the values ​​in the target key-value pair data into tree graph type data;

[0471] Determine whether the sorting method of the elements in the tree graph data is the same as the sorting method corresponding to the start position and end position of the data value of the target field;

[0472] If the sorting method of the elements in the tree graph data is different from the sorting method corresponding to the start and end positions of the data values ​​of the target field, then the elements in the tree graph data are sorted in reverse order to obtain the adjusted tree graph data; if the sorting method of the elements in the tree graph data is the same as the sorting method corresponding to the start and end positions of the data values ​​of the target field, then the elements in the tree graph data are not adjusted.

[0473] Using a binary search method, based on the target field, the starting position of the data value corresponding to the target field, and the ending position of the data value corresponding to the target field, the target element in the tree graph data whose data value of the target field is greater than or equal to the starting position of the data value corresponding to the target field and less than or equal to the ending position of the data value corresponding to the target field is determined;

[0474] The number of target elements is taken as the data processing result corresponding to the data processing instruction.

[0475] Optionally, the target set type data includes the key, target field, and target element position of the key-value pair to be processed, and the target set operation type is the fifth query operation.

[0476] Optionally, the second unit 1002 is used for:

[0477] If the key, target field, start position of the data value corresponding to the target field, and end position of the data value of the key-value pair to be processed all conform to their respective preset string types, and the key of the key-value pair to be processed meets the preset threshold condition, a key-value pair class is generated using the key, start position of the element, and end position of the element of the key-value pair to be processed.

[0478] Determine whether key-value pair data corresponding to the key-value pair class exists in the key-value database; wherein the key in the key-value pair data is the same as the key of the key-value pair to be processed;

[0479] If the key-value pair data corresponding to the key-value pair class exists in the key-value database, the key-value pair data corresponding to the key-value pair class is used as the target key-value pair data.

[0480] Optionally, the second unit 1002 is used for:

[0481] Convert the values ​​in the target key-value pair data into tree graph type data;

[0482] Based on the position of the target element, determine the target element corresponding to the position of the target element from the tree graph data;

[0483] The data value corresponding to the target field in the target element is used as the data processing result corresponding to the data processing instruction.

[0484] Optionally, the target set type data includes the key of the key-value pair to be processed and the position of the target element, and the target set operation type is a deletion operation.

[0485] Optionally, the second unit 1002 is used for:

[0486] If the key and target fields of the key-value pair to be processed both conform to their respective preset string types, and the key of the key-value pair to be processed meets the preset threshold condition, a key-value pair class is generated using the key and target fields of the key-value pair to be processed.

[0487] Determine whether key-value pair data corresponding to the key-value pair class exists in the key-value database; wherein the key in the key-value pair data is the same as the key of the key-value pair to be processed;

[0488] If the key-value pair data corresponding to the key-value pair class exists in the key-value database, the key-value pair data corresponding to the key-value pair class is used as the target key-value pair data.

[0489] Optionally, the second unit 1002 is used for:

[0490] Convert the values ​​in the target key-value pair data into tree graph type data;

[0491] Delete the target element corresponding to the position of the target element in the tree graph data;

[0492] The number of target elements successfully deleted is taken as the data processing result corresponding to the data processing instruction.

[0493] Optionally, the target set type data includes the key of the key-value pair to be processed, the target field, the starting position and ending position of the data value corresponding to the target field, the starting position of the index, and the number of index elements, and the target set operation type is the sixth query operation.

[0494] Optionally, the second unit 1002 is used for:

[0495] If the key, target field, starting position and ending position of the data value corresponding to the target field, starting position of the index, and number of index elements of the key-value pair to be processed all conform to their respective preset string types, and the key of the key-value pair to be processed meets the preset threshold condition, a key-value pair class is generated using the key, target field, starting position and ending position of the data value corresponding to the target field, starting position of the index, and number of index elements;

[0496] Determine whether key-value pair data corresponding to the key-value pair class exists in the key-value database; wherein the key in the key-value pair data is the same as the key of the key-value pair to be processed;

[0497] If the key-value pair data corresponding to the key-value pair class exists in the key-value database, the key-value pair data corresponding to the key-value pair class is used as the target key-value pair data.

[0498] Optionally, the second unit 1002 is used for:

[0499] Convert the values ​​in the target key-value pair data into tree graph type data;

[0500] Determine whether the sorting method of the elements in the tree graph data is the same as the sorting method corresponding to the start position and end position of the data value of the target field;

[0501] If the sorting method of the elements in the tree graph data is different from the sorting method corresponding to the start and end positions of the data values ​​of the target field, then the elements in the tree graph data are sorted in reverse order to obtain the adjusted tree graph data; if the sorting method of the elements in the tree graph data is the same as the sorting method corresponding to the start and end positions of the data values ​​of the target field, then the elements in the tree graph data are not adjusted.

[0502] Using a binary search method, a set of target elements is determined in the tree graph data based on the target field, the starting position of the data value corresponding to the target field, and the ending position of the data value corresponding to the target field. The data value of the target field of each target element in the set of target elements is greater than or equal to the starting position of the data value corresponding to the target field and less than or equal to the ending position of the data value corresponding to the target field.

[0503] If the data values ​​corresponding to the target fields in the target elements are all integers, the target element in the target element set corresponding to the starting position of the index is taken as the starting point, the number of target elements of the index elements is determined, and the number of target elements of the index elements is taken as the data processing result corresponding to the data processing instruction.

[0504] Optionally, the client is a Java client, and the key-value database is a shared key-value database.

[0505] Optionally, the device further includes a fourth unit for:

[0506] Receive a call instruction sent by the client; wherein the call instruction includes a target solid-state drive identifier;

[0507] The solid-state drive (SSD) corresponding to the target SSD identifier is invoked according to the target SSD identifier, and the SSD corresponding to the target SSD identifier is used as the SSD corresponding to the key-value database, and the state of the SSD corresponding to the key-value database is adjusted to a locked state.

[0508] Optionally, the fourth unit, after the step of feeding back the data processing results corresponding to each of the at least one data processing instruction to the client, further includes:

[0509] Release the memory of the solid-state drive corresponding to the key-value database, and adjust the state of the solid-state drive corresponding to the key-value database to an idle state.

[0510] Figure 11 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. At the hardware level, the electronic device includes a processor, and optionally also includes an internal bus, a network interface, and a memory. The memory may include RAM, such as high-speed random-access memory (RAM), or non-volatile memory, such as at least one disk storage device. Of course, the electronic device may also include other hardware required for other services.

[0511] The processor, network interface, and memory can be interconnected via an internal bus, which can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, or an EISA (Extended Industry Standard Architecture) bus, etc. This bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 11 The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus or one type of bus.

[0512] Memory is used to store instructions for execution. Specifically, instructions for execution are computer programs that can be executed. Memory can include main memory and non-volatile memory, and it provides the processor with execution instructions and data.

[0513] In one possible implementation, the processor reads the corresponding execution instructions from non-volatile memory into main memory and then executes them. Alternatively, it may obtain the corresponding execution instructions from other devices to form a data processing device at the logical level. The processor executes the execution instructions stored in the memory to implement the data processing method provided in any embodiment of the present invention through the executed instructions.

[0514] The above is as described in the present invention. Figure 1 The methods executed by the data processing apparatus provided in the illustrated embodiments can be applied to a processor or implemented by a processor. The processor may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above methods can be completed by integrated logic circuits in the processor's hardware or by instructions in software form. The processor can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this invention. The general-purpose processor can be a microprocessor or any conventional processor.

[0515] The steps of the method disclosed in the embodiments of this invention can be directly manifested as being executed by a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software modules can reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. This storage medium is located in memory, and the processor reads information from the memory and, in conjunction with its hardware, completes the steps of the above method.

[0516] This invention also proposes a readable medium that stores execution instructions. When the stored execution instructions are executed by the processor of an electronic device, the electronic device can execute the data processing method provided in any embodiment of this invention, and specifically execute the method described above for data querying.

[0517] The electronic devices described in the foregoing embodiments may be computers.

[0518] Those skilled in the art will understand that embodiments of the present invention can be provided as methods or computer program products. Therefore, the present invention can be implemented in a completely hardware embodiment, a completely software embodiment, or a combination of software and hardware.

[0519] The various embodiments in this invention are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the device embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions of the method embodiments.

[0520] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0521] The above description is merely an embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principle of the present invention should be included within the scope of the claims of the present invention.

Claims

1. A data processing method, characterized by, The method is applied to a solid-state drive corresponding to a key-value database, and the method includes: Receive at least one data processing instruction sent by the client; wherein each data processing instruction includes: target set type data, target set operation type; Parallel data processing is performed on the at least one data processing instruction to obtain the data processing result corresponding to each of the at least one data processing instruction; wherein, for each data processing instruction, target key-value pair data in the key-value database is determined according to the target set type data, wherein each key-value pair data in the key-value database includes a key and at least one value, each value includes at least one ordered set, and each ordered set includes at least one element, wherein each element includes at least one field and data values ​​corresponding to each field, and multiple elements in each ordered set are sorted according to the data values ​​corresponding to preset fields; data processing corresponding to the target set operation type is performed on the target key-value pair data to obtain the data processing result corresponding to the data processing instruction; The data processing results corresponding to each of the at least one data processing instructions are fed back to the client. The target set type data includes the key of the key-value pair to be processed, the target field, the starting position and ending position of the data value corresponding to the target field, the starting position of the index, and the number of index elements. The target set operation type is the sixth query operation. The step of determining the target key-value pair data in the key-value database based on the target set type data includes: If the key, target field, starting position and ending position of the data value corresponding to the target field, starting position of the index, and number of index elements of the key-value pair to be processed all conform to their respective preset string types, and the key of the key-value pair to be processed meets the preset threshold condition, a key-value pair class is generated using the key, target field, starting position and ending position of the data value corresponding to the target field, starting position of the index, and number of index elements; Determine whether key-value pair data corresponding to the key-value pair class exists in the key-value database; wherein the key in the key-value pair data is the same as the key of the key-value pair to be processed; If the key-value pair data corresponding to the key-value pair class exists in the key-value database, the key-value pair data corresponding to the key-value pair class shall be used as the target key-value pair data. The step of performing data processing on the target key-value pair data according to the target set operation type to obtain the data processing result corresponding to the data processing instruction includes: Convert the values ​​in the target key-value pair data into tree graph type data; Determine whether the sorting method of the elements in the tree graph data is the same as the sorting method corresponding to the start position and end position of the data value of the target field; If the sorting method of the elements in the tree graph data is different from the sorting method corresponding to the start and end positions of the data values ​​of the target field, then the elements in the tree graph data are sorted in reverse order to obtain the adjusted tree graph data; if the sorting method of the elements in the tree graph data is the same as the sorting method corresponding to the start and end positions of the data values ​​of the target field, then the elements in the tree graph data are not adjusted. Using a binary search method, a set of target elements is determined in the tree graph data based on the target field, the starting position of the data value corresponding to the target field, and the ending position of the data value corresponding to the target field. The data value of the target field of each target element in the set of target elements is greater than or equal to the starting position of the data value corresponding to the target field and less than or equal to the ending position of the data value corresponding to the target field. If the data values ​​corresponding to the target fields in the target elements are all integers, the target element in the target element set corresponding to the starting position of the index is taken as the starting point, the number of target elements of the index elements is determined, and the number of target elements of the index elements is taken as the data processing result corresponding to the data processing instruction.

2. The method of claim 1, wherein, The target set type data includes the key of the key-value pair to be processed, the target field, and the data value corresponding to the target field. The target set operation type is the first add operation.

3. The method of claim 2, wherein, The step of determining the target key-value pair data in the key-value database based on the target set type data includes: If the key, target field, and data value corresponding to the target field of the key-value pair to be processed all conform to their respective preset string types, the key of the key-value pair to be processed meets the preset threshold condition, and each target field has a corresponding data value, then a key-value pair class is generated using the key, target field, and data value corresponding to the target field of the key-value pair to be processed. Determine whether key-value pair data corresponding to the key-value pair class exists in the key-value database; wherein the key in the key-value pair data is the same as the key of the key-value pair to be processed; If the key-value pair data corresponding to the key-value pair class exists in the key-value database, the key-value pair data corresponding to the key-value pair class shall be used as the target key-value pair data. If the key-value pair data corresponding to the key-value pair class does not exist in the key-value database, an empty key-value pair data is created in the key-value database, and the empty key-value pair data is used as the target key-value pair data.

4. The method of claim 3, wherein, The step of performing data processing on the target key-value pair data according to the target set operation type to obtain the data processing result corresponding to the data processing instruction includes: Convert the values ​​in the target key-value pair data into tree graph type data; Insert the target field and its corresponding data value as an element into the tree graph data to obtain the updated tree graph data. The updated tree graph data is converted into values ​​in the target key-value pair data; The data processing result corresponding to the data processing instruction is determined to be that the element was added successfully, and the number of elements that were successfully added is taken as the data processing result corresponding to the data processing instruction.

5. The method of claim 1, wherein, The target set type data includes the keys of the key-value pairs to be processed, and the target set operation type is a first query operation.

6. The method of claim 5, wherein, The step of determining the target key-value pair data in the key-value database based on the target set type data includes: If the key of the key-value pair to be processed conforms to a preset string type and the key of the key-value pair to be processed conforms to a preset threshold condition, then a key-value pair class is generated using the key of the key-value pair to be processed. Determine whether key-value pair data corresponding to the key-value pair class exists in the key-value database; wherein the key in the key-value pair data is the same as the key of the key-value pair to be processed; If the key-value pair data corresponding to the key-value pair class exists in the key-value database, the key-value pair data corresponding to the key-value pair class is used as the target key-value pair data.

7. The method of claim 6, wherein, The step of performing data processing on the target key-value pair data according to the target set operation type to obtain the data processing result corresponding to the data processing instruction includes: Convert the values ​​in the target key-value pair data into tree graph type data; Determine the number of elements in the tree graph data; The number of elements in the tree graph data is taken as the data processing result corresponding to the data processing instruction.

8. The method according to any one of claims 1-7, characterized in that, The client is a Java client, and the key-value database is a combined key-value database.

9. The method according to any one of claims 1 to 7, characterized in that, Prior to the step of receiving at least one data processing instruction sent by the client, the method further includes: Receive a call instruction sent by the client; wherein the call instruction includes a target solid-state drive identifier; The system calls the solid-state drive corresponding to the target solid-state drive identifier according to the target solid-state drive identifier, and uses the solid-state drive corresponding to the target solid-state drive identifier as the solid-state drive corresponding to the key-value database, and adjusts the state of the solid-state drive corresponding to the key-value database to a locked state.

10. The method of claim 9, wherein, After the step of feeding back the data processing results corresponding to each of the at least one data processing instruction to the client, the method further includes: Release the memory of the solid-state drive corresponding to the key-value database, and adjust the state of the solid-state drive corresponding to the key-value database to an idle state.

11. A data processing apparatus, characterized by The device is applied to a solid-state drive corresponding to a key-value database, and the device includes: The first unit is used to receive at least one data processing instruction sent by the client; wherein each data processing instruction includes: target set type data and target set operation type; The second unit is used to perform parallel data processing on the at least one data processing instruction to obtain the data processing result corresponding to each of the at least one data processing instruction; wherein, for each data processing instruction, target key-value pair data in the key-value database is determined according to the target set type data, wherein each key-value pair data in the key-value database includes a key and at least one value, each value includes at least one ordered set, and each ordered set includes at least one element, wherein each element includes at least one field and the data value corresponding to each field, and the multiple elements in each ordered set are sorted according to the data value corresponding to a preset field; the target key-value pair data is then processed... The data processing corresponding to the target set operation type is performed to obtain the data processing result corresponding to the data processing instruction; wherein, the target set type data includes the key of the key-value pair to be processed, the target field, the start position and end position of the data value corresponding to the target field, the start position of the index, and the number of index elements, and the target set operation type is the sixth query operation; the step of determining the target key-value pair data in the key-value database based on the target set type data includes: if the key, target field, start position and end position of the data value corresponding to the target field, the start position of the index, and the number of index elements of the key-value pair to be processed all conform to their respective preset string types. Furthermore, the keys of the key-value pairs to be processed meet a preset threshold condition. Using the key, target field, the start and end positions of the data values ​​corresponding to the target field, the index start position, and the number of index elements, a key-value pair class is generated. It is then determined whether key-value pair data corresponding to the key-value pair class exists in the key-value database. The keys in the key-value pair data are the same as the keys of the key-value pairs to be processed. If key-value pair data corresponding to the key-value pair class exists in the key-value database, the key-value pair data corresponding to the key-value pair class is used as the target key-value pair data. The target key-value pair data undergoes data processing corresponding to the target set operation type to obtain the data processing result corresponding to the data processing instruction. The results include: converting the values ​​in the target key-value pair data into tree graph data; determining whether the sorting method of the elements in the tree graph data is the same as the sorting method corresponding to the start and end positions of the data values ​​of the target field; if the sorting method of the elements in the tree graph data is not the same as the sorting method corresponding to the start and end positions of the data values ​​of the target field, then reversing the order of the elements in the tree graph data to obtain the adjusted tree graph data; if the sorting method of the elements in the tree graph data is the same as the sorting method corresponding to the start and end positions of the data values ​​of the target field, then not adjusting the elements in the tree graph data.Using a binary search approach, a set of target elements is determined in the tree graph data based on the target field, the starting position of the data value corresponding to the target field, and the ending position of the data value corresponding to the target field. The data value of the target field of each target element in the set is greater than or equal to the starting position of the data value corresponding to the target field and less than or equal to the ending position of the data value corresponding to the target field. If the data values ​​corresponding to the target fields in the target elements are all integers, the target element in the set corresponding to the starting position of the index is used as the starting point to determine the target element of the specified number of index elements. The target element of the specified number of index elements is then used as the data processing result corresponding to the data processing instruction. The third unit is used to feed back the data processing results corresponding to each of the at least one data processing instruction to the client.