Data processing method and device

Through parallel data processing methods, it solves the performance bottleneck problem of Jedis in high-concurrency environments, realizes efficient connection and data processing between clients and key-value databases, and improves performance and user experience.

CN118760718AActive Publication Date: 2024-10-11SHENZHEN PENGLAI SMART NUMBER TECH CO LTD
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202410829371.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-25
Publication Date
2024-10-11
Estimated Expiration
2044-06-25

AI Technical Summary

Technical Problem

The existing Jedis Java client library has performance bottlenecks in high-concurrency environments, is not suitable for non-blocking and asynchronous operations, and lacks connection pool management, resulting in increased development complexity.

Method used

Provide a data processing method and device that uses preset data processing instructions to enable the client to efficiently connect to the key-value database, improve performance through parallel data processing, reduce operation delays, and achieve efficient data processing.

Benefits of technology

Through parallel data processing, application performance is improved, operation delays and data processing costs are reduced, user experience is improved, and it is suitable for high concurrency environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118760718A_ABST
    Figure CN118760718A_ABST
Patent Text Reader

Abstract

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

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 that 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 string type data and target 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 string type data, wherein each key-value pair data in the key-value database includes a key and at least one value, and each value is a string; performing data processing corresponding to the target 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 string type data and target 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 string type data, wherein each key-value pair data in the key-value database includes a key and at least one value, and each value is a string; data processing corresponding to the target operation type is performed on the target key-value pair data to obtain data processing results 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 string type data, target 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 string type data, wherein each key-value pair data in the key-value database includes a key and at least one value, and each value is a string; performing data processing corresponding to the target 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 flowchart of a data processing method provided by an embodiment of the present invention;

[0028] Figure 8 A schematic diagram of the structure of a data processing device provided by an embodiment of the present invention;

[0029] Fig. 9 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0030] 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.

[0031] Various non-limiting embodiments of the present invention are described in detail below in conjunction with the accompanying drawings.

[0032] 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:

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

[0034] 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).

[0035] Each data processing instruction may include: target string type data and target operation type. The target string type data may be understood as relevant information of the string type to be processed, such as the key and / or value of the key-value pair to be processed. The target operation type may be understood as the operation mode to be performed on the key-value pair to be processed, such as query, delete, update, etc.

[0036] 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.

[0037] 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.

[0038] 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.

[0039] Specifically, for each data processing instruction, the target key-value pair data in the key-value database can be determined according to the target string type data, that is, the target key-value pair data corresponding to the target string type data can be queried from the key-value database according to the target string type data. Each key-value pair data in the key-value database includes a key and at least one value, and each value is a string.

[0040] Then, the target key-value pair data can be processed according to the target 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 operation type, and the processed data processing result is obtained. For example, the target operation type is a string operation for performing a key-value operation, including set, get, del, exists, etc., so that fast and efficient key-value data storage and retrieval can be ensured.

[0041] Step 3: Feedback the data processing results corresponding to each of the at least one data processing instructions to the client.

[0042] 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.

[0043] 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 string type data, target 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 string type data, wherein each key-value pair data in the key-value database includes a key and at least one value, and each value is a string; performing data processing corresponding to the target 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.

[0044] Next, embodiments for different target string type data and target operation types are introduced respectively.

[0045] In one implementation, the target string type data includes the key and value of a key-value pair to be processed, and the target operation type is an operation of updating a key-value pair.

[0046] In this embodiment, the specific implementation method of determining the target key-value pair data in the key-value database according to the target character string type data may be:

[0047] If the key and value of the key-value pair to be processed meet the preset string type and the preset threshold condition, generate a key-value pair class using the key and value of the key-value pair to be processed;

[0048] 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;

[0049] 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;

[0050] 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.

[0051] Accordingly, performing data processing corresponding to the target operation type on the target key-value pair data to obtain a data processing result corresponding to the data processing instruction includes:

[0052] If the target key-value pair data is the key-value pair data corresponding to the key-value pair class, then the value in the target key-value pair data is updated to the value in the key-value pair to be processed, and the data processing result corresponding to the data processing instruction is determined to be a successful data update;

[0053] If the target key-value pair data is the empty key-value pair data, the key and value in the empty key-value pair data are updated to the key and value in the key-value pair to be processed, and the data processing result corresponding to the data processing instruction is that the data is inserted successfully.

[0054] Next, combine Figure 2 Let's give an example. Figure 2 As shown, the target string type data includes the key key and value value of the key-value pair to be processed; the target operation type is the update key-value pair operation set, that is, inserting the corresponding key-value pair according to the parameter key value, and if the key exists, updating the corresponding value. Specifically, the following steps are included:

[0055] S101: Accepts two parameters: key and value.

[0056] For S101, key and value are the key and value of the key-value pair to be processed, respectively. The key is the unique identifier of the value, and both key and value are String type data.

[0057] S102: Determine whether the parameters are legal, that is, determine whether the key and value of the key-value pair to be processed conform to the preset string type and the preset threshold condition.

[0058] For S102, it is determined whether the parameter meets the data type of String and whether the size of the parameter is reasonable, that is, it is determined whether the key and value of the key-value pair to be processed meet the preset string type. If so, S103 is executed, otherwise S104 is executed. In order to avoid overflow in storage, both key and value have a specified upper size limit. Here, it is determined that these two parameters do not exceed the maximum value. For example, the preset threshold condition is that the data size in the key does not exceed 64kb, and the data size in the value does not exceed 16mb.

[0059] S103: Initialize a HetuItem (i.e., a key-value pair class) using parameters.

[0060] For S103, legal parameters will be passed here to initialize a HetuItem object.

[0061] S104: End and return an error code.

[0062] For S104, when the two parameters received by the set method are illegal, the process ends and an error code is returned.

[0063] S105: Update using HetuItem.

[0064] For S105, the initialized HetuItem is used to update the HetuKV object. If it does not exist, an insert operation is performed. If it exists, the existing key-value pair is updated.

[0065] S106: Determine whether the update is successful.

[0066] When executing the update operation in S105, HetuKV will return an operation result. Step 106 will determine whether the result is successfully updated. If so, execute S107, otherwise execute S108.

[0067] S107: End and return “OK”.

[0068] For step 107, it indicates that the key-value pair with key and value as key values ​​has been successfully updated, and the process ends and returns "OK" to indicate that the operation is successfully completed.

[0069] S108: End and return an error code.

[0070] For step 108, it indicates that an error occurs when updating the key-value pair with key and value as key values, the process ends and a corresponding error code is returned to indicate that the set operation fails, and the cause of the error is obtained according to the error code.

[0071] In one implementation, the target string type data includes a key of a key-value pair to be processed, and the target operation type is a first query key-value pair operation.

[0072] In this embodiment, determining the target key-value pair data in the key-value database according to the target string type data includes:

[0073] If the key of the key-value pair to be processed meets the preset string type and the preset threshold condition, generate a key-value pair class using the key of the key-value pair to be processed;

[0074] 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;

[0075] 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.

[0076] Accordingly, performing data processing corresponding to the target operation type on the target key-value pair data to obtain a data processing result corresponding to the data processing instruction includes:

[0077] The value in the target key-value pair data is used as the data processing result corresponding to the data processing instruction.

[0078] Next, combine Figure 3 Let's give an example. Figure 3 As shown, the target string type data includes the key key of the key-value pair to be processed, and the target operation type is the first query key-value pair operation get, that is, querying the value corresponding to the key according to the parameter. Specifically, the following steps are included:

[0079] S201: Receive parameters, that is, determine whether the key of the key-value pair to be processed meets the preset string type and preset threshold conditions.

[0080] For step 201, a parameter key is received, which represents the key of the key-value pair to be queried.

[0081] S202: Determine whether the parameters are legal.

[0082] For step 202, it is determined whether the parameter satisfies the data type of String and whether the size of the parameter does not exceed the maximum value specified by key. If yes, execute S203, otherwise execute S207.

[0083] S203: Initialize a HetuItem using parameters.

[0084] For step 203, legal parameters will be passed here to initialize a HetuItem object.

[0085] S204: Use HetuItem to query in the HetuKV object.

[0086] For step 204, a query is performed in the HetuKV object according to the key of HetuItem.

[0087] S205: Determine whether the query is successful.

[0088] For step 205, determine whether the query is successful based on the query result of S204, and if so, execute S206, otherwise execute S207.

[0089] S206: End and return value.

[0090] For step 205, S204 will return the value corresponding to the parameter key after the query is successful. Here, this value will be returned and the operation will be ended, indicating that the operation is executed correctly and there is a return value.

[0091] S207: End and return an error code.

[0092] For step 207, it is entered after S202 and S205 fail to execute, indicating that the operation is wrong and cannot be performed, and the process ends and returns a corresponding error code, and the cause of the error is obtained according to the error code.

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

[0094] In this embodiment, determining the target key-value pair data in the key-value database according to the target string type data includes:

[0095] If the key of the key-value pair to be processed meets the preset string type and the preset threshold condition, generate a key-value pair class using the key of the key-value pair to be processed; wherein the key of multiple key-value pairs to be processed may be included;

[0096] 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;

[0097] 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.

[0098] Accordingly, performing data processing corresponding to the target operation type on the target key-value pair data to obtain a data processing result corresponding to the data processing instruction includes:

[0099] Deleting the target key-value pair data from the key-value database;

[0100] The deletion result of the target key-value pair data is used as the data processing result corresponding to the data processing instruction.

[0101] Next, combine Figure 4 Let's give an example. Figure 4 As shown, the target string type data includes the key of the key-value pair to be processed, and the target operation type is the key-value pair deletion operation del, that is, deleting a single or multiple key-value pairs. Specifically, the following steps are included:

[0102] S301: Receive parameters.

[0103] For S301, one or more parameters key[1,2...n] are received, indicating the keys of n key-value pairs to be deleted.

[0104] S302: Determine whether the parameters are legal.

[0105] For S302, determine whether the parameters of S301 are legal, where all keys must meet the data type of String and their size does not exceed the maximum value specified by the key. If yes, execute S303, otherwise execute S307.

[0106] S303: Initialize a HetuItem using parameters.

[0107] For S303, a valid key will be passed here to initialize one or more HetuItem objects.

[0108] S304: Use HetuItem to update the HetuKV object and delete the key-value pair.

[0109] For step 304, the HetuKV object is updated using these HetuItems, the HetuItems initialized with the parameters are looped through, and the key-value pairs in the HetuKV object are deleted according to their keys.

[0110] S305: Determine whether the deletion is successful.

[0111] For S305, determine whether the deletion is successful based on the deletion result of S304. If yes, execute S306, otherwise execute S307.

[0112] S306: Return the number of deletions.

[0113] For S306, a successfully executed deletion operation will increase the counter by one, indicating that a key-value pair has been successfully deleted. Finally, the number of successfully deleted key-value pairs is returned.

[0114] S307: Return an error code.

[0115] For step 307, it is entered when S302 and S305 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.

[0116] In one implementation, the target string type data includes a key of a key-value pair to be processed, and the target operation type is a second query key-value pair operation.

[0117] In this embodiment, determining the target key-value pair data in the key-value database according to the target string type data includes:

[0118] If the key of the key-value pair to be processed meets the preset string type and the preset threshold condition, generate a key-value pair class using the key of the key-value pair to be processed;

[0119] 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;

[0120] 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;

[0121] If the key-value pair data corresponding to the key-value pair class does not exist in the key-value database, a null value is used as the target key-value pair data.

[0122] Accordingly, performing data processing corresponding to the target operation type on the target key-value pair data to obtain a data processing result corresponding to the data processing instruction includes:

[0123] If the target key-value pair data is the key-value pair data corresponding to the key-value pair class, the query success result is used as the data processing result corresponding to the data processing instruction;

[0124] If the target key-value pair data is a null value, the query failure result is used as the data processing result corresponding to the data processing instruction.

[0125] Next, combine Figure 5 Let's give an example. Figure 5As shown, the target string type data includes the key key of the key-value pair to be processed, and the target operation type is the second query key-value pair operation exists, that is, querying whether these keys exist according to the keys in the parameters. Specifically, the following steps are included:

[0126] S401: Receive parameters.

[0127] For S401, a parameter key is received, indicating the key of the key-value pair to be queried.

[0128] S402: Determine whether the parameters are legal.

[0129] For S402, determine whether the parameters of S401 are legal, where the key must meet the data type of String and its size does not exceed the maximum value specified by the key. If yes, execute S403, otherwise execute S409.

[0130] S403: Initialize a HetuItem using parameters.

[0131] For S403, a valid key will be passed here to initialize a HetuItem object.

[0132] S404: Use HetuItem to query the HetuKV object.

[0133] For S404, HetuItem is used to query the HetuKV object. Here, the value does not need to be returned, and only the key-value pair of the corresponding key is queried to see whether it exists.

[0134] S405: Determine whether the query is successfully executed.

[0135] For S405, determine whether the query is successfully executed according to the execution result of S404, and if so, execute S406, otherwise execute S409.

[0136] S406: Determine whether it exists based on the query result.

[0137] For S406, determine whether HetuItem exists based on the execution result of S404, if so, execute S407, otherwise execute S408.

[0138] S407: Returns "true".

[0139] For S407, according to the judgment result of S406, if the HetuItem exists, "true" is returned.

[0140] S408: Returns "false".

[0141] For S408, according to the judgment result of S406, if the HetuItem does not exist, return "false".

[0142] S409: Returns an error code.

[0143] For S409, 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.

[0144] In one implementation, the target string type data includes the key and value of a key-value pair to be processed, and the target operation type is a query and update key-value pair operation.

[0145] In this embodiment, determining the target key-value pair data in the key-value database according to the target string type data includes:

[0146] If the key of the key-value pair to be processed meets the preset string type and the preset threshold condition, generate a key-value pair class using the key of the key-value pair to be processed;

[0147] 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;

[0148] 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;

[0149] 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.

[0150] Accordingly, performing data processing corresponding to the target operation type on the target key-value pair data to obtain a data processing result corresponding to the data processing instruction includes:

[0151] If the target key-value pair data is the key-value pair data corresponding to the key-value pair class, the value in the target key-value pair data is stored in a preset temporary variable; the value in the key-value pair class is updated to the value of the key-value pair to be processed, to obtain an updated key-value pair class; the target key-value pair data is updated using the updated key-value pair class, to obtain updated target key-value pair data, wherein the key and value in the updated target key-value pair data are the same as the value of the key-value pair to be processed; and the value stored in the preset temporary variable is used as the data processing result corresponding to the data processing instruction;

[0152] If the target key-value pair data is empty key-value pair data, update the value in the key-value pair class to the value of the key-value pair to be processed to obtain an updated key-value pair class; update the key and value in the target key-value pair data to the key and value in the updated key-value pair class, and use the fact that the key-value pair to be processed does not exist in the key-value database as the data processing result corresponding to the data processing instruction.

[0153] Next, combine Figure 6 Let's give an example. Figure 6 As shown, the target string type data includes the key key and value value of the key-value pair to be processed, and the target operation type is the query and update key-value pair operation getset, that is, querying the key-value pair and then updating it with a new value. Specifically, the following steps are included:

[0154] S501: Receive parameters.

[0155] For S501, two parameters key and value are received, where key is the target key to be queried and value is the value to be updated.

[0156] S502: Determine whether the parameters are legal.

[0157] For S502, the parameters should meet the following conditions: the data type of key is String, and the size does not exceed the maximum value specified by key; the data type of value is String, and the size does not exceed the maximum value specified by value. If yes, execute S503, otherwise execute S515

[0158] S503: Initialize a HetuItem using parameters.

[0159] For S503, a valid key will be passed here to initialize a HetuItem object.

[0160] S504: Use HetuItem to query in HetuKV

[0161] For S504, the key-value pair with the same key is searched in HetuKV according to the key of HetuKVItem.

[0162] S505: Determine whether the query is successful.

[0163] For S505, determine whether the query is successful based on the execution result of S504, and if so, execute S506, otherwise execute S511.

[0164] S506: Save the value of HetuKVItem.

[0165] For S506, a temporary variable is used to store the queried value as the old value.

[0166] S507: Set a new value for HetuKVItem.

[0167] For S507, the parameter value is used to update the value of HetuKVItem to a new value.

[0168] S508: Use HetuItem to update the HetuKV object.

[0169] For S508, the updated HetuItem is used to update the HetuKV object, that is, after finding the key-value pair with the same key, its value is updated to the value of HetuItem.

[0170] S509: Determine whether the update is successful.

[0171] For S509, the result of S508 is judged to determine whether the update is successful. If so, S510 is executed, otherwise S515 is executed.

[0172] S510: Return the saved old value.

[0173] For S510, when it is confirmed that the operation of updating the HetuKV object using HetuItem is successfully executed, the old value saved in S506 will be returned.

[0174] S511: Set a new value for HetuKVItem.

[0175] For S511, after the query operations performed by S504 and S505 fail, S511 is entered, indicating that this key-value pair does not exist in HetuKV. At this time, the new value is set to HetuKVItem to facilitate the subsequent insertion of key-value pairs.

[0176] S512: Use HetuItem to update the HetuKV object.

[0177] For S512, the HetuItem with the preset value is used to update the HetuKV object, that is, to insert the new Item.

[0178] S513: Determine whether the update is successful.

[0179] For S513, determine whether the update is successful according to the execution result of S512. If yes, execute S514, otherwise execute S515.

[0180] S514: Return NULL.

[0181] For S514, when the operations of S512 and S513 are successfully executed, NULL is returned, indicating that there is no key-value pair specified by the parameters in the HetuKv object.

[0182] S515: Return an error code.

[0183] S515 is executed when S502, S509 and S513 all fail, indicating that the operation is wrong and cannot be performed. In this case, the corresponding error code will be returned and the operation will end.

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

[0185] In this embodiment, determining the target key-value pair data in the key-value database according to the target string type data includes:

[0186] If the key of the key-value pair to be processed and the starting position and the ending position of the value to be queried meet the preset string type condition and the preset threshold condition, generate a key-value pair class using the key of the key-value pair to be processed and the starting position and the ending position of the value to be queried;

[0187] 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;

[0188] 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.

[0189] Accordingly, performing data processing corresponding to the target operation type on the target key-value pair data to obtain a data processing result corresponding to the data processing instruction includes:

[0190] The values ​​in the target key-value pair data corresponding to the starting position and the ending position of the value to be queried are used as the data processing results corresponding to the data processing instruction.

[0191] Next, combine Figure 7 Let's give an example. Figure 7As shown, the target string type data includes the key key of the key-value pair to be processed, the starting position startOffset and the ending position endOffset of the value to be queried, that is, key is the target key to be queried, startOffset is the starting position of the specified query, and endOffset is the ending position of the specified query (both start from 0 by default); the target operation type is the third query key-value pair operation getrange, that is, querying the value between the specified positions according to the parameter value. Specifically, the following steps are included:

[0192] S601: Receive parameters.

[0193] For S601, three parameters key, startOffset, and endOffset are received, where key is the target key to be queried, startOffset is the starting position of the specified query, and endOffset is the ending position of the specified query (both start from 0 by default).

[0194] S602: Determine whether the parameters are legal.

[0195] For S602, the parameters should satisfy: the data type of key is String, and the size does not exceed the maximum value specified by key; the data types of startOffset and endOffset are both long, not less than 0, and startOffset is not greater than endOffset. If S603 is executed, S607 is executed otherwise. That is, the preset string type condition is that the data type of key is String, and the data types of startOffset and endOffset are both long. The preset threshold condition is that the size of key does not exceed the maximum value specified by key, startOffset and endOffset are both not less than 0, and startOffset is not greater than endOffset.

[0196] S603: Initialize a HetuItem using parameters.

[0197] For S603, a valid key will be passed here to initialize a HetuItem object.

[0198] S604: Query according to HetuKVItem.

[0199] For S604, the key-value pair with the same key is searched in HetuKV according to the key of HetuKVItem.

[0200] S605: Determine whether the query is successful.

[0201] For S605, determine whether the query is successful based on the execution result of S604, and if so, execute S606, otherwise execute S607.

[0202] S606: End and return value.

[0203] For S606, executing this S indicates that the value corresponding to the parameter key has been found, and the end mark operation is successfully executed after the value is returned.

[0204] S607: End and return an error code.

[0205] For S607, when the parameters are illegal or the query is unsuccessful, an operation error will occur and a corresponding error code will be returned to indicate that the operation failed.

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

[0207] Receiving a call instruction sent by the client; wherein the call instruction includes a target solid state drive identifier;

[0208] 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.

[0209] Accordingly, 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:

[0210] 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.

[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 8 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 801 is used to receive at least one data processing instruction sent by a client; wherein each data processing instruction includes: target string type data and target operation type;

[0215] The second unit 802 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, target key-value pair data in the key-value database is determined according to the target string type data, wherein each key-value pair data in the key-value database includes a key and at least one value, and each value is a string; data processing corresponding to the target operation type is performed on the target key-value pair data to obtain data processing results corresponding to the data processing instruction;

[0216] The third unit 803 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 string type data includes the key and value of the key-value pair to be processed, and the target operation type is an operation of updating the key-value pair.

[0218] Optionally, the second unit 802 is configured to:

[0219] If the key and value of the key-value pair to be processed meet the preset string type and the preset threshold condition, generate a key-value pair class using the key and value of the key-value pair to be processed;

[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] 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.

[0223] Optionally, the second unit 802 is configured to:

[0224] If the target key-value pair data is the key-value pair data corresponding to the key-value pair class, then the value in the target key-value pair data is updated to the value in the key-value pair to be processed, and the data processing result corresponding to the data processing instruction is determined to be a successful data update;

[0225] If the target key-value pair data is the empty key-value pair data, the key and value in the empty key-value pair data are updated to the key and value in the key-value pair to be processed, and the data processing result corresponding to the data processing instruction is that the data is inserted successfully.

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

[0227] Optionally, the second unit 802 is configured to:

[0228] If the key of the key-value pair to be processed meets the preset string type and the preset threshold condition, generate a key-value pair class using the key of the key-value pair to be processed;

[0229] 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;

[0230] 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.

[0231] Optionally, the second unit 802 is used to: use the value in the target key-value pair data as the data processing result corresponding to the data processing instruction.

[0232] Optionally, the target string type data includes the key of the key-value pair to be processed, and the target operation type is a key-value pair deletion operation.

[0233] Optionally, the second unit 802 is used to: if the key of the key-value pair to be processed meets the preset string type and the preset threshold condition, generate a key-value pair class using the key of the key-value pair to be processed;

[0234] 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;

[0235] 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.

[0236] Optionally, the second unit 802 is used to: delete the target key-value pair data from the key-value database;

[0237] The deletion result of the target key-value pair data is used as the data processing result corresponding to the data processing instruction.

[0238] Optionally, the target string type data includes the key of the key-value pair to be processed, and the target operation type is a second query key-value pair operation.

[0239] Optionally, the second unit 802 is configured to:

[0240] If the key of the key-value pair to be processed meets the preset string type and the preset threshold condition, generate a key-value pair class using the key of the key-value pair to be processed;

[0241] 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;

[0242] 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;

[0243] If the key-value pair data corresponding to the key-value pair class does not exist in the key-value database, a null value is used as the target key-value pair data.

[0244] Optionally, the second unit 802 is used to: if the target key-value pair data is the key-value pair data corresponding to the key-value pair class, use the query success result as the data processing result corresponding to the data processing instruction;

[0245] If the target key-value pair data is a null value, the query failure result is used as the data processing result corresponding to the data processing instruction.

[0246] Optionally, the target string type data includes the key and value of the key-value pair to be processed, and the target operation type is a query and update key-value pair operation.

[0247] Optionally, the second unit 802 is configured to:

[0248] If the key of the key-value pair to be processed meets the preset string type and the preset threshold condition, generate a key-value pair class using the key of the key-value pair to be processed;

[0249] 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;

[0250] 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;

[0251] 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.

[0252] Optionally, the second unit 802 is configured to:

[0253] If the target key-value pair data is the key-value pair data corresponding to the key-value pair class, the value in the target key-value pair data is stored in a preset temporary variable; the value in the key-value pair class is updated to the value of the key-value pair to be processed, to obtain an updated key-value pair class; the target key-value pair data is updated using the updated key-value pair class, to obtain updated target key-value pair data, wherein the key and value in the updated target key-value pair data are the same as the value of the key-value pair to be processed; and the value stored in the preset temporary variable is used as the data processing result corresponding to the data processing instruction;

[0254] If the target key-value pair data is empty key-value pair data, update the value in the key-value pair class to the value of the key-value pair to be processed to obtain an updated key-value pair class; update the key and value in the target key-value pair data to the key and value in the updated key-value pair class, and use the fact that the key-value pair to be processed does not exist in the key-value database as the data processing result corresponding to the data processing instruction.

[0255] Optionally, the target string type data includes the key of the key-value pair to be processed, the starting position and the ending position of the value to be queried, and the target operation type is a third query key-value pair operation.

[0256] Optionally, the second unit 802 is used to: if the key of the key-value pair to be processed and the starting position and the ending position of the value to be queried meet a preset string type condition and a preset threshold condition, generate a key-value pair class using the key of the key-value pair to be processed and the starting position and the ending position of the value to be queried;

[0257] 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;

[0258] 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.

[0259] Optionally, the second unit 802 is used to: use the values ​​corresponding to the starting position and the ending position of the value to be queried in the target key-value pair data as the data processing result corresponding to the data processing instruction.

[0260] Optionally, the client is a Java client, and the key-value database is a HetuKV key-value database.

[0261] 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:

[0262] Receiving a call instruction sent by the client; wherein the call instruction includes a target solid state drive identifier;

[0263] 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.

[0264] 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:

[0265] 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.

[0266] Fig. 9 : 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.

[0267] 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, Fig. 9 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.

[0268] 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.

[0269] 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.

[0270] 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.

[0271] 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.

[0272] 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.

[0273] The electronic device described in the above embodiments may be a computer.

[0274] 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.

[0275] 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.

[0276] 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.

[0277] 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 string type data and target 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 string type data, wherein each key-value pair data in the key-value database includes a key and at least one value, and each value is a string; performing data processing corresponding to the target 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 string type data includes the key and value of the key-value pair to be processed, and the target operation type is an update key-value pair 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 string type data includes: If the key and value of the key-value pair to be processed meet the preset string type and the preset threshold condition, generate a key-value pair class using the key and value 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; 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 according to claim 3, characterized in that The performing data processing corresponding to the target operation type on the target key-value pair data to obtain a data processing result corresponding to the data processing instruction includes: If the target key-value pair data is the key-value pair data corresponding to the key-value pair class, then the value in the target key-value pair data is updated to the value in the key-value pair to be processed, and the data processing result corresponding to the data processing instruction is determined to be a successful data update; If the target key-value pair data is the empty key-value pair data, the key and value in the empty key-value pair data are updated to the key and value in the key-value pair to be processed, and the data processing result corresponding to the data processing instruction is that the data is inserted successfully.

5. The method according to claim 1, characterized in that The target string type data includes the key of the key-value pair to be processed, and the target operation type is a first query key-value pair 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 string type data includes: If the key of the key-value pair to be processed meets the preset string type and 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 operation type on the target key-value pair data to obtain a data processing result corresponding to the data processing instruction includes: The value in the target key-value pair data 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 string type data includes the key of the key-value pair to be processed, and the target operation type is a key-value pair deletion 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 string type data includes: If the key of the key-value pair to be processed meets the preset string type and 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.

10. The method according to claim 9, characterized in that The performing data processing corresponding to the target operation type on the target key-value pair data to obtain a data processing result corresponding to the data processing instruction includes: Deleting the target key-value pair data from the key-value database; The deletion result of the target key-value pair data 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 string type data includes the key of the key-value pair to be processed, and the target operation type is a second query key-value pair 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 string type data includes: If the key of the key-value pair to be processed meets the preset string type and 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; If the key-value pair data corresponding to the key-value pair class does not exist in the key-value database, a null value 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 operation type on the target key-value pair data to obtain a data processing result corresponding to the data processing instruction includes: If the target key-value pair data is the key-value pair data corresponding to the key-value pair class, the query success result is used as the data processing result corresponding to the data processing instruction; If the target key-value pair data is a null value, the query failure result 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 string type data includes the key and value of the key-value pair to be processed, and the target operation type is a query and update key-value pair 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 string type data includes: If the key of the key-value pair to be processed meets the preset string type and 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; 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.

16. The method according to claim 15, characterized in that The performing data processing corresponding to the target operation type on the target key-value pair data to obtain a data processing result corresponding to the data processing instruction includes: If the target key-value pair data is the key-value pair data corresponding to the key-value pair class, the value in the target key-value pair data is stored in a preset temporary variable; the value in the key-value pair class is updated to the value of the key-value pair to be processed, to obtain an updated key-value pair class; the target key-value pair data is updated using the updated key-value pair class, to obtain updated target key-value pair data, wherein the key and value in the updated target key-value pair data are the same as the value of the key-value pair to be processed; and the value stored in the preset temporary variable is used as the data processing result corresponding to the data processing instruction; If the target key-value pair data is empty key-value pair data, update the value in the key-value pair class to the value of the key-value pair to be processed to obtain an updated key-value pair class; update the key and value in the target key-value pair data to the key and value in the updated key-value pair class, and use the fact that the key-value pair to be processed does not exist in the key-value database as the data processing result corresponding to the data processing instruction.

17. The method according to claim 1, characterized in that The target string type data includes the key of the key-value pair to be processed, the starting position and the ending position of the value to be queried, and the target operation type is a third query key-value pair operation.

18. The method according to claim 17, characterized in that Determining target key-value pair data in the key-value database according to the target string type data includes: If the key of the key-value pair to be processed and the starting position and the ending position of the value to be queried meet the preset string type condition and the preset threshold condition, generate a key-value pair class using the key of the key-value pair to be processed and the starting position and the ending position of the value to be queried; 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.

19. The method according to claim 18, characterized in that The performing data processing corresponding to the target operation type on the target key-value pair data to obtain a data processing result corresponding to the data processing instruction includes: The values ​​in the target key-value pair data corresponding to the starting position and the ending position of the value to be queried are used as the data processing results corresponding to the data processing instruction.

20. The method according to any one of claims 1 to 19, characterized in that: The client is a Java client, and the key-value database is a co-existing key-value database.

21. The method according to any one of claims 1 to 20, 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.

22. The method according to claim 21, 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.

23. 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 string type data and target 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 string type data, wherein each key-value pair data in the key-value database includes a key and at least one value, and each value is a string; data processing corresponding to the target operation type is performed on the target key-value pair data to obtain data processing results 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.

24. 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 22.

25. 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 22.

Citation Information

Patent Citations

  • Method and device for concurrent execution of terminal database

    CN107025225A

  • Data processing method and device, terminal and storage medium

    CN109885577A

  • Data indexing method and device and electronic equipment

    CN113157689A

  • Loop detection method, device, equipment and storage medium

    CN113783753A

  • KV database data management method and device, computing equipment and storage medium

    CN114328453A