Data processing method and device
Through parallel data processing methods, it solves the performance bottleneck problem of Jedis in high-concurrency environments, realizes efficient client connection and data processing, and improves application performance and user experience.
Patent Information
- Application Number
- CN202410829374.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-25
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2044-06-25
AI Technical Summary
The existing Jedis Java client library has performance bottlenecks in high-concurrency environments and does not support non-blocking and asynchronous operations. This increases development complexity and requires additional configuration of connection pools.
Provide a data processing method and device, which performs parallel data processing by receiving data processing instructions from the client, and performs target set operations on key-value data to achieve efficient parallel data processing, improve application performance, and reduce operation delays.
It enables the client to efficiently connect to the key-value database, improves data processing efficiency, reduces data processing costs, improves user experience, and is suitable for high concurrency environments.
Smart Images

Figure CN118733654A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a data processing method and device. Background Art
[0002] NoSQL databases are a type of database that emerged outside of relational databases. They are designed to address challenges such as large-scale data storage and high concurrent access that traditional relational databases have difficulty coping with. Key-value databases are a major type of NoSQL database. They store data in the form of key-value pairs and are suitable for simple data models and fast read and write operations. In particular, Redis, as an in-memory key-value database, is widely used due to its fast read and write operations and rich features (such as publish / subscribe, transactions, pipelines, etc.).
[0003] In the field of Java development, with the rapid development of Internet applications, the demand for high performance, scalability, and flexibility is growing. Traditional relational databases may face performance bottlenecks when processing large amounts of data and high concurrent requests, so developers begin to seek alternatives. The emergence of key-value databases fills this demand gap and provides more options for Java developers. Java is a widely used programming language that is used in enterprise, network, mobile, and embedded systems. Many enterprise-level applications and microservice architectures are based on the Java technology stack. Developing a Java interface for key-value databases enables these applications to easily access and operate key-value databases to meet the needs of application scenarios.
[0004] Key-value databases are usually high-performance and scalable because they are based on a simple key-value data model that allows fast read and write operations. Through the Java interface, developers can take advantage of the performance of key-value databases and use them for application scenarios that require caching, session management, real-time data processing, etc. Developing a Java interface for a key-value database can simplify the development process by abstracting and encapsulating database operations. Developers can use familiar Java APIs to interact with key-value databases without having to delve into the underlying implementation of the database. This simplification helps improve development efficiency and reduce the probability of errors.
[0005] In the prior art, Jedis is a Java client library for Redis, which provides comprehensive support and direct mapping of Redis commands. Jedis provides encapsulation of Redis commands, including strings, hashes, lists, sets, ordered sets, transactions, publish / subscribe, etc. It also provides an API that allows developers to interact using Redis's native commands.
[0006] Jedis runs synchronously, which means that Jedis will block while waiting for Redis to respond. This may cause performance bottlenecks, especially in high-concurrency environments. Since Jedis is synchronous, it is not suitable for scenarios that require non-blocking and asynchronous operations. Jedis does not come with a connection pool and requires additional configuration of a connection pool to manage connections. This may increase development complexity. Therefore, there is an urgent need for a method that can be applied to high-concurrency environments and enable Java clients to efficiently connect to key-value databases. Summary of the invention
[0007] The present invention provides a data processing method and device, which can utilize preset data processing instructions to enable a client to efficiently connect to a key-value database, and can perform parallel data processing on key-value data in the key-value database, thereby realizing efficient parallel data processing, thereby improving the performance of the application, improving the performance of the client, and reducing operation delays, thereby achieving improved data processing efficiency, reducing data processing costs, and improving the user experience of data processing.
[0008] In a first aspect, the present invention provides a data processing method, the method being applied to a solid-state hard disk corresponding to a key-value database, the method comprising:
[0009] Receive 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;
[0010] 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 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 data set, and each data set includes at least one element; performing data processing corresponding to the target set operation type on the target key-value pair data to obtain data processing results corresponding to the data processing instruction;
[0011] Feedback the data processing results corresponding to each of the at least one data processing instructions to the client.
[0012] In a second aspect, the present invention provides a data processing device, the device is applied to a solid state drive corresponding to a key-value database, the device comprising:
[0013] 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;
[0014] The second unit 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 data set, and each data set includes at least one element; data processing corresponding to the target set operation type is performed on the target key-value pair data to obtain a data processing result corresponding to the data processing instruction;
[0015] The third unit is used to feed back the data processing results corresponding to each of the at least one data processing instructions to the client.
[0016] In a third aspect, the present invention provides a readable medium, comprising execution instructions. When a processor of an electronic device executes the execution instructions, the electronic device executes any method described in the first aspect.
[0017] In a fourth aspect, the present invention provides an electronic device, comprising a processor and a memory storing execution instructions, wherein when the processor executes the execution instructions stored in the memory, the processor executes any method described in the first aspect.
[0018] It can be seen from the above technical scheme that the method provided by the present invention can be applied to a solid-state hard disk corresponding to a key-value database, and the method includes: receiving at least one data processing instruction sent by a client; wherein each data processing instruction includes: target set type data, target set operation type; performing parallel data processing on the at least one data processing instruction to obtain a data processing result corresponding to each of the at least one data processing instructions; wherein, for each data processing instruction, the 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 data set, and each data set includes at least one element; performing data processing corresponding to the target set operation type on the target key-value pair data to obtain a data processing result corresponding to the data processing instruction; and feeding back the data processing result corresponding to each of the at least one data processing instructions to the client. Since in the present application, the key-value pair data in the key-value database can be processed in parallel according to at least one data processing instruction, and the data processing results corresponding to each of the at least one data processing instructions can be obtained, and the data processing results corresponding to each of the at least one data processing instructions can be fed back to the client, therefore, the present application can use preset data processing instructions to enable the client to efficiently connect to the key-value database, and can perform parallel data processing on the key-value pair data in the key-value database, thereby realizing efficient parallel data processing, thereby improving the performance of the application, improving the performance of the client, and reducing operation delays, thereby achieving improved data processing efficiency, reducing data processing costs, and thereby improving the user experience of data processing.
[0019] The further effects of the above-mentioned non-conventional preferred manner will be described below in conjunction with specific embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the embodiments of the present invention or the existing technical solutions, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0021] Figure 1 A flowchart of a data processing method provided by an embodiment of the present invention;
[0022] Figure 2 A flowchart of a data processing method provided by an embodiment of the present invention;
[0023] Figure 3A flowchart of a data processing method provided by an embodiment of the present invention;
[0024] Figure 4 A flowchart of a data processing method provided by an embodiment of the present invention;
[0025] Figure 5 A flowchart of a data processing method provided by an embodiment of the present invention;
[0026] Figure 6 A flowchart of a data processing method provided by an embodiment of the present invention;
[0027] Figure 7 A schematic diagram of the structure of a data processing device provided by an embodiment of the present invention;
[0028] Figure 8 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0029] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0030] Various non-limiting embodiments of the present invention are described in detail below in conjunction with the accompanying drawings.
[0031] See also Figure 1 , shows a data processing method in an embodiment of the present invention, which can be applied to a solid-state hard disk corresponding to a key-value database. In this embodiment, the method may include the following steps:
[0032] Step 1: Receive at least one data processing instruction sent by a client.
[0033] In this embodiment, when the client needs to process the key-value pair data in the key-value database through the solid-state drive, the client can send at least one data processing instruction to the solid-state drive corresponding to the key-value database. In one implementation, the client can be a Java client, and the key-value database can be a HetuKV key-value database (i.e., HetuKV key-value database).
[0034] Among them, each data processing instruction may include: target set type data, target set operation type. The target set type data can be understood as the relevant information of the data set and / or the elements in the data set that need to be processed, for example, the key and / or value of the key-value pair to be processed. It should be noted that each key-value pair data in the key-value database includes a key and at least one value, each value includes at least one data set, and each data set includes at least one element. The target set operation type can be understood as the operation method that needs to be performed on the key-value pair to be processed, for example, data set / element query, element deletion, element addition, etc.
[0035] It should be noted that the key-value data in the key-value database can be relevant data in the fields of artificial intelligence, content recommendation, image rendering, financial risk control, Internet of Things, game development, big data analysis, etc. For example, in the field of artificial intelligence, the solution provided by this application can be used to train and deploy machine learning and deep learning models. The application method is: used to read and process a large amount of training data, quickly preprocess data, cache intermediate results, and store the trained model in a high-speed cache for real-time reasoning and prediction; in the field of content recommendation systems, content recommendation systems usually need to quickly access and process a large amount of user and content data to generate personalized recommendations. The solution provided by this application can be used to cache user preferences, recommendation history, popular content, etc. to reduce the reading pressure of the database and improve the real-time and accuracy of the recommendation system; in the field of image rendering and processing, fast access and caching of intermediate results are crucial to performance. The solution provided by this application can be used to store and cache intermediate data generated during the rendering process, such as textures, image slices, rendering results, etc., to help speed up the rendering process and reduce computing load; financial institutions need to quickly process and analyze large amounts of transaction and user data to detect fraud and Managing risks. 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 field of Internet of Things (IoT), IoT devices generate a large amount of data, and rapid processing and analysis of this data are crucial to 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., to help the IoT system quickly respond to events and instructions and ensure 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, rankings, etc. to improve the response speed and performance of the game; big data analysis requires 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 transfer station to help achieve rapid import, processing, and caching of data, thereby improving the performance of the analysis system.
[0036] Step 2: 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 instructions.
[0037] In this embodiment, if multiple data processing instructions are received at the same time, the multiple data processing instructions can be processed in parallel to obtain data processing results corresponding to each of the at least one data processing instructions. For example, when the client can be a Java client and the key-value database can be 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 is multi-core parallel, and the Java client supports and can implement multi-threading, so multiple cores of the CPU can be enabled, and each core processes a data processing instruction separately. For example, when storing a large String file in a multi-core environment, the file can be split into multiple parts, and each core stores a part of the data separately, which can be performed simultaneously without interfering with each other. This multi-core parallel processing method can greatly improve the performance of data processing.
[0038] Specifically, for each data processing instruction, the target key-value pair data in the key-value database can be determined according to 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 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, and each value includes at least one data set, and each data set includes at least one element. It can be understood that in this embodiment, the value corresponding to the key in each key-value pair data is at least one data set (i.e., set), for example, it can be a hashset (hash data set), that is, using key-value storage to store a hashset (hash data set), which can be understood as storing a data set (i.e., set). Wherein, the key is the unique identifier of this data set, and the value is this data set (i.e., set). There are multiple elements in the data set (i.e., set). Simply put, the key is the name of a data set, and the value corresponding to this key is the element (members) in this data set.
[0039] 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. In other words, 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 set operation for performing key value operations, including sadd, scard, sismember, srem, etc., so that fast and efficient key value data storage and retrieval can be ensured.
[0040] Step 3: Feedback the data processing results corresponding to each of the at least one data processing instructions to the client.
[0041] After obtaining the data processing result respectively corresponding to the at least one data processing instruction, the data processing result respectively corresponding to the at least one data processing instruction may be fed back to the client.
[0042] It can be seen from the above technical scheme that the method provided by the present invention can be applied to a solid-state hard disk corresponding to a key-value database, and the method includes: receiving at least one data processing instruction sent by a client; wherein each data processing instruction includes: target set type data, target set operation type; performing parallel data processing on the at least one data processing instruction to obtain a data processing result corresponding to each of the at least one data processing instructions; wherein, for each data processing instruction, the 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 data set, and each data set includes at least one element; performing data processing corresponding to the target set operation type on the target key-value pair data to obtain a data processing result corresponding to the data processing instruction; and feeding back the data processing result corresponding to each of the at least one data processing instructions to the client. Since in the present application, the key-value pair data in the key-value database can be processed in parallel according to at least one data processing instruction, and the data processing results corresponding to each of the at least one data processing instructions can be obtained, and the data processing results corresponding to each of the at least one data processing instructions can be fed back to the client, therefore, the present application can use preset data processing instructions to enable the client to efficiently connect to the key-value database, and can perform parallel data processing on the key-value pair data in the key-value database, thereby realizing efficient parallel data processing, thereby improving the performance of the application, improving the performance of the client, and reducing operation delays, thereby achieving improved data processing efficiency, reducing data processing costs, and thereby improving the user experience of data processing.
[0043] Next, implementation examples for different target set type data and target set operation types are introduced respectively.
[0044] In one implementation, the target collection type data includes a key of a key-value pair to be processed and a target element, and the target collection operation type is an element adding operation.
[0045] In this embodiment, the specific implementation method of determining the target key-value pair data in the key-value database according to the target set type data may be:
[0046] If the key of the key-value pair to be processed and the target element conform to the preset string type, and the key of the key-value pair to be processed meets the preset threshold condition, generate a key-value pair class using the key of the key-value pair to be processed and the target element;
[0047] Determine whether there is key-value pair data corresponding to the key-value pair class 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;
[0048] 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.
[0049] Accordingly, performing data processing corresponding to the target set operation type on the target key-value pair data to obtain a data processing result corresponding to the data processing instruction includes:
[0050] Convert the value in the target key-value pair data into a data set;
[0051] For each target element, determine whether the data set includes the target element; if the data set does not include the target element, insert the target element into the data set to obtain an updated data set;
[0052] After all target elements are processed, the updated data set is converted into the values in the target key-value pair data;
[0053] It is determined that the data processing result corresponding to the data processing instruction is that the element is added successfully, and the number of the successfully added target elements is used as the data processing result corresponding to the data processing instruction.
[0054] Next, combine Figure 2 Let's give an example. Figure 2As shown, the target set type data includes the key of the key-value pair to be processed and the target element members; the target set operation type is the element addition operation sadd, that is, to add one or more elements to the data set, the elements already existing in the data set will be ignored. Specifically, the following steps are included:
[0055] S101: Receive data processing instructions.
[0056] For step 101, at least two parameters such as key and members are accepted, where key indicates the key to be inserted and members indicates the member to be inserted. That is, the target set type data includes the key key of the key-value pair to be processed and the target element members; the target set operation type is the element adding operation sadd.
[0057] S102: Determine whether the parameters are legal
[0058] For step 102, determine whether the parameters meet the type, where both key and members must meet the data of String type (that is, the default string type is String type), and the size of key cannot exceed the maximum value specified by kye, for example, the data size in key does not exceed 64kb. If yes, execute S103, otherwise execute S114.
[0059] S103: Initialize a HetuItem (i.e., a key-value pair class) using parameters.
[0060] For step 103, legal parameters will be passed here to initialize a HetuItem object, that is, a key-value pair class is generated using the key of the key-value pair to be processed and the target element.
[0061] S104: Check whether the value of HetuKVItem is successful.
[0062] For step 104, use HetuKVItem to query the key-value pair corresponding to key in HetuKV, and determine whether the query is successful. If so, execute S105, otherwise execute S109. That is, determine whether the 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.
[0063] S105: Decode value to obtain hashset and traverse member parameters.
[0064] For step 105, S104 extracts the corresponding value after successful query, converts the obtained value into a hashset type, and starts traversal, that is, converts the value in the target key-value pair data into a data set.
[0065] S106: Determine whether the traversal is completed.
[0066] For step 106, determine whether the traversal is completed, if so, execute S109, otherwise execute S107.
[0067] S107: Determine whether member exists in hashset.
[0068] For step 107, determine whether the current member exists in the hashset, if so, execute S106, otherwise execute S108.
[0069] S108: Insert member into hashset.
[0070] For step 108, the non-existent member will be inserted into the hashset, and the next members will be traversed. That is, for each target element, it is determined whether the data set includes the target element; if the data set does not include the target element, the target element is inserted into the data set to obtain an updated data set.
[0071] S109: Encode the hashset.
[0072] For step 109, after the traversal is completed, the entire hashset is converted into a byteStream type, that is, after all target elements are processed, the updated data set is converted into the value in the target key-value pair data.
[0073] S110: Update the value of HetuKVItem.
[0074] For step 110, the converted byteStreamhashset is updated to the value of HetuKVItem.
[0075] S111: Use HetuKVItem to update the HetuKV object.
[0076] For step 111, HetuKV is updated using HetuKVItem.
[0077] S112: Determine whether the update is successful.
[0078] For step 112, determine whether the update is successful, and if successful, execute 113; otherwise, execute 114.
[0079] S113: Return the number of successfully inserted members.
[0080] For step 113, the number of successfully inserted members will be returned.
[0081] S114: Return error code
[0082] As for step 114, it is entered when S102 and S112 fail to execute, which means that the operation is wrong and cannot be performed. At this time, the corresponding error code will be returned and the operation will end.
[0083] In one implementation, 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.
[0084] In this embodiment, the specific implementation method of determining the target key-value pair data in the key-value database according to the target set type data may be:
[0085] If the key of the key-value pair to be processed conforms to the preset string type, and the key of the key-value pair to be processed conforms to the preset threshold condition, generate a key-value pair class using the key of the key-value pair to be processed;
[0086] Determine whether there is key-value pair data corresponding to the key-value pair class 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;
[0087] 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.
[0088] Correspondingly, performing data processing corresponding to the target set operation type on the target key-value pair data to obtain a data processing result corresponding to the data processing instruction includes:
[0089] Determine whether the value in the target key-value pair data is a null value;
[0090] If the value in the target key-value pair data is not a null value, converting the value in the target key-value pair data into a data set;
[0091] determining the number of elements in the data set;
[0092] The number of elements in the data set is used as the data processing result corresponding to the data processing instruction.
[0093] Next, combine Figure 3 Let's give an example. Figure 3 As shown, the target set type data includes the key of the key-value pair to be processed, and the target set operation type is the first query operation scard, that is, the number of elements in the statistical set. Specifically, the following steps are included:
[0094] S201: Receive data processing instructions.
[0095] For step 201, a parameter key is accepted, indicating the key of the aggregation to be queried. The target collection type data includes the key key of the key-value pair to be processed, and the target collection operation type is the first query operation.
[0096] S202: Determine whether the parameters are legal.
[0097] For step 202, determine whether the parameters are legal, where the key must satisfy the String type data (ie, the default string type is String type), and the size of the key cannot exceed the maximum value specified by kye. If yes, execute S203, otherwise execute S210.
[0098] S203: Initialize a HetuItem using parameters.
[0099] For step 203, legal parameters will be passed here to initialize a HetuItem object. That is, a key-value pair class is generated using the key of the key-value pair to be processed.
[0100] S204: Query whether the key is successful.
[0101] For step 204, use HetuItem to query the key-value pair corresponding to key, and determine whether the query is successful. If so, execute S205, otherwise execute S210.
[0102] S205: Query the value of HetuKVItem.
[0103] For step 205, after the query is successful, its value is extracted.
[0104] S206: Determine whether value is empty.
[0105] For step 206, it is determined whether value is null. If so, S209 is executed, otherwise, S207 is executed. It is determined whether the value in the target key-value pair data is null.
[0106] S207: Convert vlue to Set type.
[0107] For step 207, the non-empty value will be converted into a set type. That is, if the value in the target key-value pair data is not an empty value, the value in the target key-value pair data is converted into a data set.
[0108] S208: Return the number of Members.
[0109] For step 208, the number of elements in the set in value is queried, and the operation is terminated after returning the value. That is, the number of elements in the data set is determined; the number of elements in the data set is used as the data processing result corresponding to the data processing instruction.
[0110] S209: Returns "0".
[0111] For step 209, if value is empty, "0" is returned.
[0112] S210: Return an error code.
[0113] For step 210, it is entered when S202 and S206 fail to execute, which means that the operation is wrong and cannot be performed. At this time, the corresponding error code will be returned and the operation will end.
[0114] In one implementation, the target set type data includes a key of a key-value pair to be processed and a target element, and the target set operation type is a second query operation.
[0115] In this embodiment, determining the target key-value pair data in the key-value database according to the target set type data includes:
[0116] If the key of the key-value pair to be processed and the target element conform to the preset string type, and the key of the key-value pair to be processed meets the preset threshold condition, generate a key-value pair class using the key of the key-value pair to be processed and the target element;
[0117] Determine whether there is key-value pair data corresponding to the key-value pair class 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;
[0118] 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.
[0119] Correspondingly, performing data processing corresponding to the target set operation type on the target key-value pair data to obtain a data processing result corresponding to the data processing instruction includes:
[0120] Convert the value in the target key-value pair data into a data set;
[0121] Determining whether the data set includes the target element;
[0122] If the data set includes the target element, taking the result that the data set includes the target element as the data processing result corresponding to the data processing instruction;
[0123] If the data set does not include the target element, the result that the data set does not include the target element is used as the data processing result corresponding to the data processing instruction.
[0124] Next, combine Figure 4 Let's give an example. Figure 4 As shown, the target set type data includes the key key of the key-value pair to be processed and the target element member, and the target set operation type is the second query operation sismember, that is, judging whether the element is stored in the data set corresponding to the key. Specifically, it includes the following S:
[0125] S301: Receive parameters.
[0126] For step 301, two parameters key and member are received. key is the key of the target collection, and member is the element to be determined whether it exists.
[0127] S302: Determine whether the parameters are legal.
[0128] For step 302, determine whether the parameters are legal. Both key and member are String type data, and the size of key must not exceed the maximum value specified by key. If yes, execute S303, otherwise execute S310.
[0129] S303: Initialize a HetuItem using parameters.
[0130] For step 303, legal parameters will be passed here to initialize a HetuItem object.
[0131] S304: Determine whether HetuKVItem exists.
[0132] For step 304, use HetuKVItem to query whether the key-value pair corresponding to key exists in HetuKV. If yes, execute S305, otherwise execute S310.
[0133] S305: Query the value of HetuKVItem.
[0134] For step 305, extract the value corresponding to the key.
[0135] S306: Convert value to Set type.
[0136] For step 306, the value is converted into a Set type, that is, the value in the target key-value pair data is converted into a data set.
[0137] S307: Determine whether Member is included.
[0138] For step 307, determine whether there is an element member in Se, if so, execute S308, otherwise execute S309.
[0139] S308: Return True.
[0140] For step 308, return True to end the operation, indicating that the member exists.
[0141] S309: Return False.
[0142] For step 309, the operation ends after returning False, indicating that member does not exist.
[0143] S310: Return an error code.
[0144] For step 310, it is entered when S302 and S304 fail to execute, which means that the operation is wrong and cannot be performed. At this time, the corresponding error code will be returned and the operation will end.
[0145] In one implementation, the target set type data includes a key of a key-value pair to be processed and a target element, and the target set operation type is a delete operation.
[0146] In this embodiment, determining the target key-value pair data in the key-value database according to the target set type data includes:
[0147] If the key of the key-value pair to be processed and the target element conform to the preset string type, and the key of the key-value pair to be processed meets the preset threshold condition, generate a key-value pair class using the key of the key-value pair to be processed and the target element;
[0148] Determine whether there is key-value pair data corresponding to the key-value pair class 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;
[0149] 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.
[0150] Accordingly, performing data processing corresponding to the target set operation type on the target key-value pair data to obtain a data processing result corresponding to the data processing instruction includes:
[0151] Convert the value in the target key-value pair data into a data set;
[0152] For each target element, determine whether the data set includes the target element; if the data set includes the target element, delete the target element from the data set to obtain an updated data set;
[0153] After all target elements are processed, the updated data set is converted into the values in the target key-value pair data;
[0154] It is determined that the data processing result corresponding to the data processing instruction is that the element is deleted successfully, and the number of successfully deleted target elements is used as the data processing result corresponding to the data processing instruction.
[0155] Next, combine Figure 5 Let's give an example. Figure 5 As shown, the target set type data includes the key of the key-value pair to be processed and the target element, and the target set operation type is a deletion operation srem, that is, deleting the specified element from the data set stored at the key.
[0156] Specifically, the steps include:
[0157] S401: receiving parameters
[0158] For step 401, at least two parameters such as key and members are accepted. Key represents the key of the element set to be deleted, and member represents the element to be deleted.
[0159] S402: Determine whether the parameters are legal
[0160] For step 402, determine whether the parameters are legal. Both key and member are String type data, and the size of key must not exceed the maximum value specified by key. If yes, execute S403, otherwise execute S413.
[0161] S403: Initialize a HetuKVItem using parameters
[0162] For step 403, legal parameters will be passed here to initialize a HetuItem object.
[0163] S404: Set the key of HetuKVItem
[0164] For step 404, the key of the HetuItem object is set as an input parameter.
[0165] S405: Query the value corresponding to the Key successfully
[0166] For step 405, the key is checked in HetuKV through HetuItem. If it is, execute S406, otherwise execute S413.
[0167] S406: Convert Value to Set type, count = 0
[0168] For step 406, the queried value is converted to a set type, and the count is set to 0.
[0169] S407: Traverse all Members
[0170] For step 407, determine whether to traverse all members, if so, execute S410, otherwise execute S408.
[0171] S408: If the Set contains the input Member
[0172] For step 408, determine whether the Set contains the input member, if so, execute S409, otherwise execute S407.
[0173] S409: delete member, count +1
[0174] For step 409, member is deleted and the count is set to +1.
[0175] S410: Set the new Value of HetuKVItem
[0176] For step 410, the changed set is converted to value and then set as the new value of HetuKVItem.
[0177] S411: Update to database via HetuKVItem
[0178] For step 411, HetuKVItem is updated into HetuKV.
[0179] S412: Return count
[0180] For step 412, the number of successfully deleted members is returned.
[0181] S413: Return error code
[0182] For step 413, it is entered when S402 and S405 fail to execute, which means that the operation is wrong and cannot be performed. At this time, the corresponding error code will be returned and the operation will end.
[0183] In one implementation, the target set type data includes the key of the key-value pair to be processed, and the target set operation type is a third query operation.
[0184] In this embodiment, determining the target key-value pair data in the key-value database according to the target set type data includes:
[0185] If the key of the key-value pair to be processed conforms to the preset string type, and the key of the key-value pair to be processed conforms to the preset threshold condition, generate a key-value pair class using the key of the key-value pair to be processed;
[0186] Determine whether there is key-value pair data corresponding to the key-value pair class 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;
[0187] 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.
[0188] Accordingly, performing data processing corresponding to the target set operation type on the target key-value pair data to obtain a data processing result corresponding to the data processing instruction includes:
[0189] Convert the value in the target key-value pair data into a data set;
[0190] All elements in the data set are used as data processing results corresponding to the data processing instruction.
[0191] Next, combine Figure 6 Let's give an example. Figure 6 As shown, the target set type data includes the key key of the key-value pair to be processed, and the target set operation type is the third query operation smembers, that is, counting all elements of the data set stored in the corresponding key.
[0192] Specifically, the steps include:
[0193] S501: Receive parameters.
[0194] For step 501, a parameter key is accepted, which indicates the key corresponding to the set to be queried.
[0195] S502: Determine whether the parameters are legal.
[0196] For step 502, determine whether the parameters are legal, the key must be a String type data, and the size of the key cannot exceed the maximum value specified by kye. If yes, execute S503, otherwise execute S509.
[0197] S503: Initialize a HetuKVItem using parameters.
[0198] For step 503, legal parameters will be passed here to initialize a HetuItem object.
[0199] S504: Set the key of HetuKVItem.
[0200] For step 504, the key of the HetuItem object is set as an input parameter.
[0201] S505: Determine whether HetuKVItem exists.
[0202] For step 505, the key is checked in HetuKV through HetuItem. If it is, execute S506, otherwise execute S509.
[0203] S506: Query the value of HetuKVItem.
[0204] For step 506, the value corresponding to the key is extracted.
[0205] S507: Convert the Value to the Set type.
[0206] For step 507, the queried value is converted to a set type.
[0207] S508: Return to Set.
[0208] For step 508, Set is returned, indicating that the operation is successfully executed.
[0209] S509: Return an error code.
[0210] For step 509, it is entered when S502 and S505 fail to execute, which means that the operation is wrong and cannot be performed. At this time, the corresponding error code will be returned and the operation will end.
[0211] As an example, when using the Java client to call the HetuKV key-value database, a certain solid-state drive will be specified and locked, and released after the call ends, that is, the garbage collection mechanism of the HetuKV key-value database is used to promptly release the memory occupied by the solid-state drive. In the process of locking the solid-state drive, other processes cannot use the solid-state drive. In addition, in this embodiment, data calculation is delegated to the solid-state drive, which can reduce dependence on memory, and optimize resource utilization by using the garbage collection mechanism, and lock the solid-state drive to ensure data security and reliability, thereby achieving resource optimization and security, that is, through the advantages of HetuKV, optimize resource utilization, ensure data security and reliability, and reduce memory dependence, optimize hardware resource utilization, reduce memory consumption, and make the system more flexible. In addition, it can also enhance security and control, provide complete control, and strengthen data security to ensure data security for enterprise-level applications.
[0212] So far, this embodiment has realized the processing process of the data processing method in combination with a specific application scenario. Of course, it should be considered that the above scenario is only an exemplary scenario and does not limit the method provided by the present invention. The method provided by the present invention can be extended to other data processing methods with the same principle.
[0213] like Figure 7 As shown, it is a specific embodiment of the data processing device described in this application. The device described in this embodiment is a physical device for executing the method described in the above embodiment. Its technical solution is essentially consistent with the above embodiment, and the corresponding description in the above embodiment is also applicable to this embodiment. In this embodiment, the device is applied to a solid-state hard disk corresponding to a key-value database. The device includes:
[0214] The first unit 701 is used to receive 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;
[0215] The second unit 702 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 instructions; wherein, for each data processing instruction, according to the target set type data, determine the target key-value pair data in the key-value database, 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 data set, and each data set includes at least one element; perform data processing corresponding to the target set operation type on the target key-value pair data to obtain the data processing result corresponding to the data processing instruction;
[0216] The third unit 703 is used to feed back the data processing results corresponding to the at least one data processing instruction to the client.
[0217] Optionally, the target collection type data includes the key of the key-value pair to be processed and the target element, and the target collection operation type is an element adding operation.
[0218] Optionally, the second unit 702 is specifically used for:
[0219] If the key of the key-value pair to be processed and the target element conform to the preset string type, and the key of the key-value pair to be processed meets the preset threshold condition, generate a key-value pair class using the key of the key-value pair to be processed and the target element;
[0220] Determine whether there is key-value pair data corresponding to the key-value pair class 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;
[0221] 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.
[0222] Optionally, the second unit 702 is specifically used for:
[0223] Convert the value in the target key-value pair data into a data set;
[0224] For each target element, determine whether the data set includes the target element; if the data set does not include the target element, insert the target element into the data set to obtain an updated data set;
[0225] After all target elements are processed, the updated data set is converted into the values in the target key-value pair data;
[0226] It is determined that the data processing result corresponding to the data processing instruction is that the element is added successfully, and the number of the successfully added target elements is used as the data processing result corresponding to the data processing instruction.
[0227] 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.
[0228] Optionally, the second unit 702 is specifically used for:
[0229] If the key of the key-value pair to be processed conforms to the preset string type, and the key of the key-value pair to be processed conforms to the preset threshold condition, generate a key-value pair class using the key of the key-value pair to be processed;
[0230] Determine whether there is key-value pair data corresponding to the key-value pair class 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;
[0231] 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.
[0232] Optionally, the second unit 702 is specifically used for:
[0233] Determine whether the value in the target key-value pair data is a null value;
[0234] If the value in the target key-value pair data is not a null value, converting the value in the target key-value pair data into a data set;
[0235] determining the number of elements in the data set;
[0236] The number of elements in the data set is used as the data processing result corresponding to the data processing instruction.
[0237] Optionally, the target set type data includes the key of the key-value pair to be processed and the target element, and the target set operation type is a second query operation.
[0238] Optionally, the second unit 702 is specifically used for:
[0239] If the key of the key-value pair to be processed and the target element conform to the preset string type, and the key of the key-value pair to be processed meets the preset threshold condition, generate a key-value pair class using the key of the key-value pair to be processed and the target element;
[0240] Determine whether there is key-value pair data corresponding to the key-value pair class 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;
[0241] 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.
[0242] Optionally, the second unit 702 is specifically used for:
[0243] Convert the value in the target key-value pair data into a data set;
[0244] Determining whether the data set includes the target element;
[0245] If the data set includes the target element, taking the result that the data set includes the target element as the data processing result corresponding to the data processing instruction;
[0246] If the data set does not include the target element, the result that the data set does not include the target element is used as the data processing result corresponding to the data processing instruction.
[0247] Optionally, the target collection type data includes the key of the key-value pair to be processed and the target element, and the target collection operation type is a delete operation.
[0248] Optionally, the second unit 702 is specifically used for:
[0249] If the key of the key-value pair to be processed and the target element conform to the preset string type, and the key of the key-value pair to be processed meets the preset threshold condition, generate a key-value pair class using the key of the key-value pair to be processed and the target element;
[0250] Determine whether there is key-value pair data corresponding to the key-value pair class 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;
[0251] 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.
[0252] Optionally, the second unit 702 is specifically used for:
[0253] Convert the value in the target key-value pair data into a data set;
[0254] For each target element, determine whether the data set includes the target element; if the data set includes the target element, delete the target element from the data set to obtain an updated data set;
[0255] After all target elements are processed, the updated data set is converted into the values in the target key-value pair data;
[0256] It is determined that the data processing result corresponding to the data processing instruction is that the element is deleted successfully, and the number of successfully deleted target elements is used as the data processing result corresponding to the data processing instruction.
[0257] 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 third query operation.
[0258] Optionally, the second unit 702 is specifically used for:
[0259] If the key of the key-value pair to be processed conforms to the preset string type, and the key of the key-value pair to be processed conforms to the preset threshold condition, generate a key-value pair class using the key of the key-value pair to be processed;
[0260] Determine whether there is key-value pair data corresponding to the key-value pair class 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;
[0261] 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.
[0262] Optionally, the second unit 702 is specifically used for:
[0263] Convert the value in the target key-value pair data into a data set;
[0264] All elements in the data set are used as data processing results corresponding to the data processing instruction.
[0265] Optionally, the client is a Java client, and the key-value database is a HetuKV key-value database.
[0266] Optionally, the device further includes a fourth unit, configured to: before the step of receiving at least one data processing instruction sent by the client, perform the following steps:
[0267] Receiving a call instruction sent by the client; wherein the call instruction includes a target solid state drive identifier;
[0268] The solid state drive corresponding to the target solid state drive identifier is called according to the target solid state drive identifier, and the solid state drive corresponding to the target solid state drive identifier is used as the solid state drive corresponding to the key-value database, and the state of the solid state drive corresponding to the key-value database is adjusted to a locked state.
[0269] The fourth unit is further configured to: after the step of feeding back to the client the data processing results respectively corresponding to the at least one data processing instruction, perform the following steps:
[0270] The memory of the solid state drive corresponding to the key-value database is released, and the state of the solid state drive corresponding to the key-value database is adjusted to an idle state.
[0271] Figure 8: is a schematic diagram of the structure of an electronic device provided by 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. Among them, the memory may include a memory, such as a high-speed random access memory (Random-Access Memory, RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk storage, etc. Of course, the electronic device may also include hardware required for other services.
[0272] The processor, network interface and memory can be interconnected through 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. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 8 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0273] The memory is used to store execution instructions. Specifically, the execution instructions are computer programs that can be executed. The memory may include internal memory and non-volatile memory, and provides execution instructions and data to the processor.
[0274] In one possible implementation, the processor reads the corresponding execution instructions from the non-volatile memory into the memory and then runs them, and can also 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 by executing the execution instructions.
[0275] As described above, the present invention Figure 1The method performed by the data processing device provided in the illustrated embodiment can be applied to a processor or implemented by a processor. The processor may be an integrated circuit chip having signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor or instructions in the form of software. The above processor may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may 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 gates or transistor logic devices, discrete hardware components. The disclosed methods, steps and logic block diagrams in the embodiments of the present invention can be implemented or executed. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0276] The steps of the method disclosed in the embodiment of the present invention can be directly embodied as being executed by a hardware decoding processor, or can be executed by a combination of hardware and software modules in the decoding processor. The software module can be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in a memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.
[0277] An embodiment of the present invention also proposes a readable storage medium, which stores execution instructions. When the stored execution instructions are executed by a processor of an electronic device, the electronic device can execute the data processing method provided in any embodiment of the present invention, and is specifically used to execute the method described in the above-mentioned data query.
[0278] The electronic device described in the above embodiments may be a computer.
[0279] Those skilled in the art will appreciate that the embodiments of the present invention may be provided as methods or computer program products. Therefore, the present invention may be implemented in the form of a complete hardware embodiment, a complete software embodiment, or a combination of software and hardware.
[0280] The various embodiments of the present invention are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0281] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0282] The above description is only an embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent substitution, improvement, etc. made within the spirit and principle of the present invention should be included in the scope of the claims of the present invention.
Claims
1. A data processing method, characterized in that: The method is applied to a solid-state hard disk corresponding to a key-value database, and the method includes: Receive 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 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 data set, and each data set includes at least one element; performing data processing corresponding to the target set operation type on the target key-value pair data to obtain data processing results corresponding to the data processing instruction; Feedback the data processing results corresponding to each of the at least one data processing instructions to the client.
2. The method according to claim 1, characterized in that The target set type data includes the key of the key-value pair to be processed and the target element, and the target set operation type is an element adding operation.
3. The method according to claim 2, characterized in that Determining target key-value pair data in the key-value database according to the target set type data includes: If the key of the key-value pair to be processed and the target element conform to the preset string type, and the key of the key-value pair to be processed meets the preset threshold condition, generate a key-value pair class using the key of the key-value pair to be processed and the target element; Determine whether there is key-value pair data corresponding to the key-value pair class 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.
4. The method according to claim 3, characterized in that The performing data processing corresponding to the target set operation type on the target key-value pair data to obtain a data processing result corresponding to the data processing instruction includes: Convert the value in the target key-value pair data into a data set; For each target element, determine whether the data set includes the target element; if the data set does not include the target element, insert the target element into the data set to obtain an updated data set; After all target elements are processed, the updated data set is converted into the values in the target key-value pair data; It is determined that the data processing result corresponding to the data processing instruction is that the element is added successfully, and the number of the successfully added target elements is used as the data processing result corresponding to the data processing instruction.
5. The method according to claim 1, characterized in that 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.
6. The method according to claim 5, characterized in that Determining target key-value pair data in the key-value database according to the target set type data includes: If the key of the key-value pair to be processed conforms to the preset string type, and the key of the key-value pair to be processed conforms to the preset threshold condition, generate a key-value pair class using the key of the key-value pair to be processed; Determine whether there is key-value pair data corresponding to the key-value pair class 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 according to claim 6, characterized in that The performing data processing corresponding to the target set operation type on the target key-value pair data to obtain a data processing result corresponding to the data processing instruction includes: Determine whether the value in the target key-value pair data is a null value; If the value in the target key-value pair data is not a null value, converting the value in the target key-value pair data into a data set; determining the number of elements in the data set; The number of elements in the data set is used as the data processing result corresponding to the data processing instruction.
8. The method according to claim 1, characterized in that The target set type data includes the key of the key-value pair to be processed and the target element, and the target set operation type is a second query operation.
9. The method according to claim 8, characterized in that Determining target key-value pair data in the key-value database according to the target set type data includes: If the key of the key-value pair to be processed and the target element conform to the preset string type, and the key of the key-value pair to be processed meets the preset threshold condition, generate a key-value pair class using the key of the key-value pair to be processed and the target element; Determine whether there is key-value pair data corresponding to the key-value pair class 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.
10. The method according to claim 9, characterized in that The performing data processing corresponding to the target set operation type on the target key-value pair data to obtain a data processing result corresponding to the data processing instruction includes: Convert the value in the target key-value pair data into a data set; Determining whether the data set includes the target element; If the data set includes the target element, taking the result that the data set includes the target element as the data processing result corresponding to the data processing instruction; If the data set does not include the target element, the result that the data set does not include the target element is used as the data processing result corresponding to the data processing instruction.
11. The method according to claim 1, characterized in that: The target set type data includes the key of the key-value pair to be processed and the target element, and the target set operation type is a delete operation.
12. The method according to claim 11, characterized in that Determining target key-value pair data in the key-value database according to the target set type data includes: If the key of the key-value pair to be processed and the target element conform to the preset string type, and the key of the key-value pair to be processed meets the preset threshold condition, generate a key-value pair class using the key of the key-value pair to be processed and the target element; Determine whether there is key-value pair data corresponding to the key-value pair class 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.
13. The method according to claim 12, characterized in that The performing data processing corresponding to the target set operation type on the target key-value pair data to obtain a data processing result corresponding to the data processing instruction includes: Convert the value in the target key-value pair data into a data set; For each target element, determine whether the data set includes the target element; if the data set includes the target element, delete the target element from the data set to obtain an updated data set; After all target elements are processed, the updated data set is converted into the values in the target key-value pair data; It is determined that the data processing result corresponding to the data processing instruction is that the element is deleted successfully, and the number of successfully deleted target elements is used as the data processing result corresponding to the data processing instruction.
14. The method according to claim 1, characterized in that The target set type data includes the key of the key-value pair to be processed, and the target set operation type is a third query operation.
15. The method according to claim 14, characterized in that Determining target key-value pair data in the key-value database according to the target set type data includes: If the key of the key-value pair to be processed conforms to the preset string type, and the key of the key-value pair to be processed conforms to the preset threshold condition, generate a key-value pair class using the key of the key-value pair to be processed; Determine whether there is key-value pair data corresponding to the key-value pair class 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.
16. The method according to claim 15, characterized in that The performing data processing corresponding to the target set operation type on the target key-value pair data to obtain a data processing result corresponding to the data processing instruction includes: Convert the value in the target key-value pair data into a data set; All elements in the data set are used as data processing results corresponding to the data processing instruction.
17. The method according to any one of claims 1 to 16, characterized in that: The client is a Java client, and the key-value database is a co-existing key-value database.
18. The method according to any one of claims 1 to 16, characterized in that: Before the step of receiving at least one data processing instruction sent by the client, the method further includes: Receiving a call instruction sent by the client; wherein the call instruction includes a target solid state drive identifier; The solid state drive corresponding to the target solid state drive identifier is called according to the target solid state drive identifier, and the solid state drive corresponding to the target solid state drive identifier is used as the solid state drive corresponding to the key-value database, and the state of the solid state drive corresponding to the key-value database is adjusted to a locked state.
19. The method according to claim 18, characterized in that After the step of feeding back to the client the data processing results respectively corresponding to the at least one data processing instruction, the method further includes: The memory of the solid state drive corresponding to the key-value database is released, and the state of the solid state drive corresponding to the key-value database is adjusted to an idle state.
20. A data processing device, characterized in that: The device is applied to a solid state hard disk 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 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 data set, and each data set includes at least one element; data processing corresponding to the target set operation type is performed on the target key-value pair data to obtain a 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 instructions to the client.
21. A readable medium comprising an execution instruction, wherein when a processor of an electronic device executes the execution instruction, the electronic device executes the method according to any one of claims 1 to 19.
22. An electronic device, comprising a processor and a memory storing execution instructions, wherein when the processor executes the execution instructions stored in the memory, the processor executes the method according to any one of claims 1 to 19.
Citation Information
Patent Citations
Data processing method and related device
CN106339493A
Method, device and equipment for transmitting set type data
CN112491857A
Data query method, data query device, electronic equipment and storage medium
CN113051268A
KV database data management method and device, computing equipment and storage medium
CN114328453A
Data processing method, data processing device, electronic equipment and storage medium
CN115455006A
