Data processing method and device, computer program product, equipment and storage medium

By configuring hash indexes and data formats in the database system and processing structural information of large-scale data storage engines, the problem of large-scale data storage and query requirements is solved, and efficient memory utilization and hardware cost reduction are achieved.

CN118672483APending Publication Date: 2024-09-20SHENZHEN TENCENT NETWORK INFORMATION TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202310301463.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-03-17
Publication Date
2024-09-20

AI Technical Summary

Technical Problem

Existing data storage and query technologies are difficult to meet the needs of large-scale data storage and real-time query, especially when the data volume reaches T level or even billions, resulting in increased hardware costs and difficulty in ensuring data security and accuracy.

Method used

By obtaining the structural information of the data storage engine in the database system, configuring the data format and hash index, responding to data access requests, and performing data sorting to delete invalid records, real-time data sorting and disk space optimization are achieved, and hardware overhead is reduced.

Benefits of technology

It improves memory utilization, reduces memory fragmentation and hardware costs, ensures data security and accuracy, and reduces user costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118672483A
    Figure CN118672483A
Patent Text Reader

Abstract

The invention provides a data processing method. The data processing method comprises the steps of obtaining structure information of a data storage engine in a database system; configuring data format information for the data storage engine based on the structure information; determining a data file structure in the data storage engine based on the data format information; configuring a hash index for the data storage engine; in response to a received data access request, executing an operation matched with the data access request according to the data file structure and the Hash index to obtain a processing result of the data access request; and performing data arrangement on the data storage engine according to a processing result of the data access request, and deleting invalid data records. The invention further provides a data processing device, a computer program product, electronic equipment and a storage medium. The hardware overhead of a database system can be reduced, and the use cost of a user is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to data processing technology, and in particular to data processing methods, devices, computer program products, electronic devices and storage media. Background Art

[0002] With the widespread popularization and application of the Internet, the terabyte-level growth of data means that traditional data storage and query methods can no longer meet the needs of such large-scale data storage and real-time query. For example, the data of video clicks or text browsing has reached billions of data points according to various dimensions of aggregation analysis.

[0003] Related data storage or data query technologies are usually suitable for the storage of specific data, such as data with fixed length and fixed type. This limits the application scenarios of data storage or query services. At the same time, when the amount of storage or query data reaches the terabyte level or even the billion level, the memory usage is large, which increases the hardware cost required for users. Summary of the invention

[0004] In view of this, the embodiments of the present application provide a data processing method, device, computer program product, electronic device and storage medium, which can provide a new data storage engine, realize real-time data organization, effectively reduce disk space overhead, and at the same time, use hash indexes to process data access requests, which can improve memory utilization, reduce memory fragmentation and memory overhead, and ensure data security and accuracy without occupying the hardware overhead of the database system, thereby reducing the user's usage cost.

[0005] The technical solution of the embodiment of the present application is implemented as follows:

[0006] The present application provides a data processing method, the method comprising:

[0007] Acquire structural information of a data storage engine in a database system; configure data format information for the data storage engine based on the structural information;

[0008] Based on the data format information, determining a data file structure in the data storage engine;

[0009] Configuring a hash index for the data storage engine;

[0010] In response to the received data access request, an operation matching the data access request is performed according to the data file structure and the hash index to obtain a processing result of the data access request;

[0011] According to the processing result of the data access request, the data storage engine is sorted and invalid data records are deleted.

[0012] The present application also provides a data processing device, the device comprising:

[0013] An information transmission module, used to obtain structural information of a data storage engine in a database system; and configure data format information for the data storage engine based on the structural information;

[0014] An information processing module determines the data file structure in the data storage engine based on the data format information;

[0015] The information processing module is used to configure a hash index for the data storage engine;

[0016] The information processing module is used to respond to the received data access request and perform an operation matching the data access request according to the data file structure and the hash index to obtain a processing result of the data access request;

[0017] The information processing module is used to organize the data of the data storage engine and delete invalid data records according to the processing result of the data access request.

[0018] In the above scheme,

[0019] The information processing module is used to determine the data writing operation standard of the data storage engine according to the use requirements of the database, wherein the data writing operation standard is: writing data in log-type information and prohibiting data deletion;

[0020] The information processing module is used to determine the data sorting standard of the data storage engine according to the usage requirements of the database, wherein the data sorting standard is: deleting invalid data in the data storage engine and merging data files in the data storage engine.

[0021] In the above scheme,

[0022] The information processing module is used to determine version information of the data storage engine configuration record structure based on the structure information;

[0023] The information processing module is used to configure format information of different dimensions in the data storage engine according to the version information of the record structure, wherein the format information of different dimensions includes:

[0024] The information processing module is used for cyclic redundancy check code, modification time of record, version information of record, hash value and size of key value, and life span of record;

[0025] The information processing module is used to configure a magic number for the data format information, wherein the magic number is used to ensure the availability of the data through the suffix name of the data.

[0026] In the above scheme,

[0027] The information processing module is used to determine the data storage volume in the data storage engine based on the data format information;

[0028] The information processing module is used to determine the alignment of the data in the data storage engine based on the data format information.

[0029] In the above scheme,

[0030] The information processing module is used to calculate a hash value according to a keyword of the read request when the data access request is a read request;

[0031] The information processing module is used to determine the corresponding hash bucket according to the hash value;

[0032] The information processing module is used to determine the data block required by the read request according to the offset and record size in the data file structure by using the hash bucket;

[0033] The information processing module is used to execute the read request according to the data block required by the read request and obtain the processing result of the read request.

[0034] In the above scheme,

[0035] The information processing module is used for serializing the write request when the data access request is a write request;

[0036] The information processing module is used to align the records of the write request and configure a buffer;

[0037] Writing the write request into a buffer of the data storage engine according to the data file structure;

[0038] According to the hash index, the address in the hash bucket is updated.

[0039] In the above scheme,

[0040] The information processing module is used to search for a record corresponding to the deletion request in the hash conflict array when the data access request is a deletion request;

[0041] The information processing module is used to delete the records in the hash conflict array.

[0042] In the above scheme,

[0043] The information processing module is used to traverse all data files of the data storage engine according to the processing result of the data access request, and obtain valid records and invalid records in all data files;

[0044] The information processing module is used to merge the valid records in all data files, delete the invalid records in all data files, and obtain the merged result of the valid records.

[0045] In the above scheme,

[0046] The information processing module is used to determine the cloud server network corresponding to the database system according to the identification information of the data of the database system;

[0047] The information processing module is used to store the update results of the data of the database system in the cloud server network;

[0048] The information processing module is used to send the update result to the database system through the cloud server network when data loss occurs in the database system.

[0049] The present application also provides an electronic device, the electronic device comprising:

[0050] A memory for storing executable instructions;

[0051] The processor is used to implement the preceding data processing method when running the executable instructions stored in the memory.

[0052] An embodiment of the present application also provides a computer-readable storage medium storing executable instructions, which implement the preceding data processing method when executed by a processor.

[0053] The embodiments of the present application have the following beneficial effects:

[0054] 1) The present application obtains structural information of a data storage engine in a database system; configures data format information for the data storage engine based on the structural information; determines the data file structure in the data storage engine based on the data format information; configures a hash index for the data storage engine; in response to a received data access request, performs an operation matching the data access request according to the data file structure and the hash index to obtain a processing result of the data access request; and uses the hash index to process the data access request, thereby improving memory utilization and reducing memory fragmentation and memory overhead.

[0055] 2) According to the processing result of the data access request, the data storage engine is sorted and invalid data records are deleted, which can realize real-time data sorting, effectively reduce disk space overhead, ensure data security and accuracy without occupying the hardware overhead of the database system, and reduce the user's usage cost. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] Figure 1 It is a schematic diagram of the use environment of the data processing method provided in the embodiment of the present application;

[0057] Figure 2 A schematic diagram of the structure of a data processing device provided in an embodiment of the present application;

[0058] Figure 3 An optional flowchart of the data processing method provided in the embodiment of the present application;

[0059] Figure 4 This is a schematic diagram of the structure of a data storage engine in an embodiment of the present invention;

[0060] Figure 5 A schematic diagram of structural information of a data storage engine in an embodiment of the present invention;

[0061] Figure 6 It is a schematic diagram of the structure recorded in an embodiment of the present invention;

[0062] Figure 7 A schematic diagram of a data file structure in an embodiment of the present invention;

[0063] Figure 8 A schematic diagram of a hash index in an embodiment of the present invention;

[0064] Fig. 9 A schematic diagram of a processing process when a data access request is a read request in an embodiment of the present invention;

[0065] Fig.10 It is a schematic diagram of the storage structure of data provided in the embodiment of the present application;

[0066] Fig.11A is a schematic diagram of the data structure corresponding to the metadata block provided in the embodiment of the present application;

[0067] Fig. 11B is a schematic diagram of a data structure corresponding to a data block provided in an embodiment of the present application;

[0068] Fig.12 A schematic diagram of the processing process of a write request and a delete request in an embodiment of the present invention;

[0069] Fig.13 A schematic diagram of a data sorting process in an embodiment of the present invention;

[0070] Fig.14 This is a schematic diagram of the architecture of the database system in this application;

[0071] Fig.15 A process diagram of the data processing method provided in this application. DETAILED DESCRIPTION

[0072] In order to make the purpose, technical solutions and advantages of the present invention clearer, the present invention will be further described in detail below in conjunction with the accompanying drawings. The described embodiments should not be regarded as limiting the present invention. All other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present invention.

[0073] In the following description, reference is made to “some embodiments”, which describe a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0074] Before further describing the embodiments of the present invention in detail, the nouns and terms involved in the embodiments of the present invention are described. The nouns and terms involved in the embodiments of the present invention are subject to the following interpretations.

[0075] 1) Terminals, including but not limited to: ordinary terminals and dedicated terminals, wherein the ordinary terminals maintain a long connection and / or a short connection with the sending channel, and the dedicated terminals maintain a long connection with the sending channel.

[0076] 2) Client, which is a carrier for implementing specific functions in the terminal. For example, a mobile client (APP) is a carrier for specific functions in a mobile terminal, such as the function of executing report making or the function of displaying reports.

[0077] 3) Logical log: A log that records logical changes to data in a database system, generally used to synchronize data between database systems.

[0078] 4) Data table: In a database system, a data table is an object used to store data. It is a collection of structured data and contains one or more fields.

[0079] 5) Field: In a database system, the columns of a data table are called fields, and each field contains the information of this column.

[0080] 6) Record: Information about all fields in a row of data in a data table in a database system

[0081] 7) Hash bucket: In fact, hash bucket is a way to solve hash table conflicts. There may be multiple elements in the same position in the hash table. To deal with the hash conflict problem, each position in the hash table is represented by a hash bucket. The key code is hashed to the same hole through the hash algorithm, and a linked list is set in the hole where the conflict occurs. The linked list under this hole is like a bucket that holds elements.

[0082] 8) Key-list (klist): The stored data is of key-value (kv) type, but the value is a list and needs to be sorted based on a key attribute or tag in the value when storing. Each element in the list stored in klist will contain multiple tags, which can be represented by tags. One of the tags is used to control the sorting when writing. This is called the primary key attribute or tag, recorded as the primary key tag.

[0083] 9) Database engine file: a file that stores database records

[0084] 10) Magic: A magic number in a program code, a constant or string used to identify a file format or protocol type.

[0085] 11) KV storage engine: The KV storage engine is a component that provides high-performance reading and writing of KV data structures. It is usually embedded in other database servers to provide a series of solutions for reading and writing KV data from disk.

[0086] 12) IO: Input / Output. In computer science, it refers to the exchange of information between computers or between people and computers. For example, two computers interact through a network card, such as writing data to a hard disk or reading data from a hard disk.

[0087] Before introducing the data processing method provided by the present application, the data processing process in the related technology is first introduced. The common kv storage engines in the related technology are mainly divided into three categories: hash storage engine, B-tree storage engine, and LSM (Log Structure Merge Tree) tree storage engine. The hash storage engine is a persistent implementation of the hash table, the B-tree storage engine is a persistent implementation of the B-tree, and the LSM storage engine uses batch dump technology to avoid random disk writes. However, in the related key-value or key-list technology, the stored data is often required to be of fixed length and the data type is fixed, which cannot be applied to various data types, limiting the business use scenarios of the data processing method. In addition, most of the related technologies use a single-threaded locking method to implement data storage, and the performance limit of the system cannot be exerted in terms of data storage performance. In addition, there is also an implementation based on kv, which separates data storage and data calculation, but this technology requires multi-level indexing operations when reading and writing data, which is easy to cause read and write diffusion, frequent input and output operations, extended time, and poor timely response effect.

[0088] In order to solve the above-mentioned defects, the embodiments of the present application provide a data processing method, apparatus, device and computer-readable storage medium, which can improve the response speed of data processing, and can store attribute data of different attributes to realize a mode-free data storage method.

[0089] The following describes an exemplary application of the data processing device provided by the embodiment of the present application. The device provided by the embodiment of the present application can be implemented as various types of user terminals such as a laptop computer, a tablet computer, a desktop computer, a set-top box, a mobile device (for example, a mobile phone, a portable music player, a personal digital assistant, a dedicated messaging device, a portable gaming device), a smart watch, a smart home appliance, and a vehicle-mounted terminal, and can also be implemented as a server. The following describes an exemplary application when the device is implemented as a server.

[0090] See also Figure 1 , Figure 1 It is an architectural diagram of the data processing system provided in an embodiment of the present application. To support a data processing application, in the data processing system 100, the terminal (terminal 400-1 and terminal 400-2 are shown as examples) is connected to the server 200 via the network 300. The network 300 can be a wide area network or a local area network, or a combination of the two.

[0091] In some embodiments, the server 200 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content distribution networks (CDN, Content Delivery Network), and big data and artificial intelligence platforms. The terminal 400 may be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, a smart home appliance, a car terminal, etc., but is not limited thereto. The terminal and the server may be directly or indirectly connected via wired or wireless communication, which is not limited in the embodiments of the present application.

[0092] The terminal 400 is used to send a data processing request for a target data item to the server 200 .

[0093] The server 200 is used to respond to a data processing request of a target object for a target data item, obtain the target object's data to be stored, and the data to be stored includes attribute data for at least one attribute of the target data item; determine the target data node corresponding to the target object in the data node group used to store location indication information; wherein the target data node includes at least one data block, each data block corresponds to an attribute, and is used to store location indication information of different data items; store each attribute data in a target storage area, and determine the location of each attribute data in the target storage area; based on the location of each attribute data in the target storage area, fill in the location indication information of each attribute data to the corresponding data block in the target data node.

[0094] In some embodiments, the terminal is deployed with a client for the target data project (client 410-1 and client 410-2 are shown as examples). In actual implementation, the client can be a video playback client, a music playback client, etc. The target object sends a data processing request to the server based on the client for the target data project, and the server obtains the data to be stored of the target object, and the data to be stored includes attribute data for at least one attribute of the target data project; determines the target data node corresponding to the target object; wherein the target data node includes at least one data block, each data block corresponds to an attribute, and is used to store location indication information of different data items; stores each attribute data in the target storage area, and determines the location of each attribute data in the target storage area; based on the location of each attribute data in the target storage area, fills the location indication information of each attribute data into the corresponding data block in the target data node.

[0095] The data processing method provided in the embodiment of the present application can also be applied to various scenarios such as cloud technology, artificial intelligence, smart transportation, and assisted driving. Taking the cloud technology scenario as an example, the cloud server receives a data processing request for a target data item sent from a terminal device in the cloud network, and the cloud server obtains each attribute data of the target object to be stored, stores each attribute data in the cloud storage, obtains the storage location corresponding to the attribute data in the cloud storage, and writes the location indication information corresponding to the storage location of each attribute data to the corresponding data block in the target data node.

[0096] In some embodiments of the present invention, the data processing process can be completed by a computing platform. The computing platform can be a platform located in a trusted third-party device, or a platform located in one of multiple servers or distributed in multiple servers. The computing platform can exchange data with each server. Figure 1 The multiple business party servers (which may be servers holding different business data) in the example may be servers of the same data category, for example, all are bank category servers, or all are shopping platform servers, etc. Multiple servers may also be servers of different categories, for example, server 10-1 is a shopping platform server, server 10-2 is an instant messaging client server corresponding to the shopping platform, or server 10-1 is a bank's head office server, and server 10-2 is a branch server. In the data processing scenario, the business data provided by these servers are usually the same type of business data. For example, if server 10-1 is a shopping platform server and server 10-2 is a lending platform server, if the shopping platform is bound to a payment bank card number and the lending platform is bound to a withdrawal and repayment bank card number, the business data provided by both parties for data processing may be a bank card number and transfer information or lending information. If both the shopping platform server and the lending platform server register the user's bank card information and ID card information, the business data provided by both parties for data processing may also be bank card information and ID card information. In other business scenarios, business data may also include other data, which will not be listed here one by one.

[0097] As an example, the server 200 is used to deploy a data processing device to implement the data processing method provided by the present application. When executing the data processing method, the structural information of the data storage engine is obtained in the database system; the data format information is configured for the data storage engine based on the structural information; the data file structure in the data storage engine is determined based on the data format information; the hash index is configured for the data storage engine; in response to the received data access request, according to the data file structure and the hash index, an operation matching the data access request is performed to obtain the processing result of the data access request; according to the processing result of the data access request, the data storage engine is sorted and invalid data records are deleted, and finally the memory resource overhead is reduced in the data processing process. At the same time, the hash index in the memory adopts page management, which can improve the utilization of memory and reduce memory fragmentation and memory overhead.

[0098] The structure of the data processing device of the embodiment of the present application is described in detail below. The data processing device can be implemented in various forms, such as a dedicated terminal with a data processing function, or a server with a data processing function, such as the preceding Figure 1 Server 200 in. Figure 2 The schematic diagram of the structure of the data processing device provided in the embodiment of the present application can be understood as follows: Figure 2 Only an exemplary structure of the data processing device is shown, not all structures, and can be implemented as needed. Figure 2 Partial or complete structure shown.

[0099] The data processing device provided in the embodiment of the present application includes: at least one processor 201, a memory 202, a user interface 203 and at least one network interface 204. The various components in the data processing device 20 are coupled together through a bus system 205. It can be understood that the bus system 205 is used to realize the connection and communication between these components. In addition to the data bus, the bus system 205 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, in Figure 2 Various buses are labeled as bus system 205 .

[0100] The user interface 203 may include a display, a keyboard, a mouse, a trackball, a click wheel, keys, buttons, a touch pad or a touch screen.

[0101] It is understood that the memory 202 can be a volatile memory or a non-volatile memory, and can also include both volatile and non-volatile memories. The memory 202 in the embodiment of the present application can store data to support the operation of the terminal (such as 10-1). Examples of these data include: any computer program for operating on the terminal (such as 10-1), such as an operating system and an application. Among them, the operating system includes various system programs, such as a framework layer, a core library layer, a driver layer, etc., which are used to implement various basic services and process hardware-based tasks. The application can include various applications.

[0102] In some embodiments, the data processing device provided in the embodiments of the present application can be implemented in a combination of software and hardware. As an example, the data processing device provided in the embodiments of the present application can be a processor in the form of a hardware decoding processor, which is programmed to execute the data processing method provided in the embodiments of the present application. For example, the processor in the form of a hardware decoding processor can adopt one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field programmable gate arrays (FPGAs), or other electronic components.

[0103] As an example of a data processing device provided in an embodiment of the present application being implemented by a combination of software and hardware, the data processing device provided in an embodiment of the present application can be directly embodied as a combination of software modules executed by a processor 201. The software module can be located in a storage medium, and the storage medium is located in a memory 202. The processor 201 reads the executable instructions included in the software module in the memory 202, and completes the data processing method provided in an embodiment of the present application in combination with necessary hardware (for example, including the processor 201 and other components connected to the bus 205).

[0104] As an example, the processor 201 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where the general-purpose processor can be a microprocessor or any conventional processor, etc.

[0105] As an example of a data processing device provided in an embodiment of the present application being implemented by hardware, the device provided in an embodiment of the present application can be directly executed by a processor 201 in the form of a hardware decoding processor, for example, being executed by one or more application specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field programmable gate arrays (FPGAs), or other electronic components to implement the data processing method provided in an embodiment of the present application.

[0106] The memory 202 in the embodiment of the present application is used to store various types of data to support the operation of the data processing device 20. Examples of such data include: any executable instructions for operating on the data processing device 20, such as executable instructions, and the program for implementing the data processing method in the embodiment of the present application can be included in the executable instructions.

[0107] In other embodiments, the data processing device provided in the embodiments of the present application may be implemented in software. Figure 2 The data processing device stored in the memory 202 is shown, which may be software in the form of a program and a plug-in, and includes a series of modules. As an example of a program stored in the memory 202, a data processing device may be included, and the data processing device includes the following software modules: an information transmission module 2081 and an information processing module 2082. When the software modules in the data processing device are read into the RAM by the processor 201 and executed, the data processing method provided in the embodiment of the present application will be implemented. The functions of each software module in the data processing device will be described below, specifically including:

[0108] The information transmission module 2081 is used to obtain the structural information of the data storage engine in the database system; and configure the data format information for the data storage engine based on the structural information;

[0109] The information processing module 2082 determines the data file structure in the data storage engine based on the data format information;

[0110] Information processing module 2082, used to configure hash index for data storage engine;

[0111] The information processing module 2082 is used to respond to the received data access request, perform an operation matching the data access request according to the data file structure and the hash index, and obtain a processing result of the data access request;

[0112] The information processing module 2082 is used to organize the data of the data storage engine and delete invalid data records according to the processing results of the data access request.

[0113] In the above scheme,

[0114] The information processing module 2082 is used to determine the data writing operation standard of the data storage engine according to the use requirements of the database, wherein the data writing operation standard is: writing data in log-type information and prohibiting data deletion;

[0115] The information processing module 2082 is used to determine the data sorting standard of the data storage engine according to the use requirements of the database, wherein the data sorting standard is: deleting invalid data in the data storage engine and merging data files in the data storage engine.

[0116] In the above scheme,

[0117] An information processing module 2082, configured to determine version information of a data storage engine configuration record structure based on the structure information;

[0118] The information processing module 2082 is used to configure the format information of different dimensions in the data storage engine according to the version information of the record structure, wherein the format information of different dimensions includes:

[0119] Information processing module 2082, for cyclic redundancy check code, modification time of record, version information of record, hash value and size of key value, and lifetime of record;

[0120] The information processing module 2082 is used to configure a magic number for the data format information, wherein the magic number is used to ensure the availability of the data through the suffix name of the data.

[0121] In the above scheme,

[0122] An information processing module 2082 is used to determine a data storage volume in a data storage engine based on the data format information;

[0123] The information processing module 2082 is used to determine the alignment of data in the data storage engine based on the data format information.

[0124] In the above scheme,

[0125] The information processing module 2082 is used to calculate a hash value according to a keyword of the read request when the data access request is a read request;

[0126] The information processing module 2082 is used to determine the corresponding hash bucket according to the hash value;

[0127] An information processing module 2082 is used to determine the data block required for the read request according to the offset and record size in the data file structure using a hash bucket;

[0128] The information processing module 2082 is used to execute the read request according to the data block required by the read request and obtain the processing result of the read request.

[0129] In the above scheme,

[0130] The information processing module 2082 is used for serializing the write request when the data access request is a write request;

[0131] The information processing module 2082 is used to align the records of the write request and configure the buffer;

[0132] Write the write request into the buffer of the data storage engine according to the data file structure;

[0133] According to the hash index, the address in the hash bucket is updated.

[0134] In the above scheme,

[0135] The information processing module 2082 is used to search the record corresponding to the deletion request in the hash conflict array when the data access request is a deletion request;

[0136] The information processing module 2082 is used to delete the records in the hash conflict array.

[0137] In the above scheme,

[0138] The information processing module 2082 is used to traverse all data files of the data storage engine according to the processing result of the data access request, and obtain valid records and invalid records in all data files;

[0139] The information processing module 2082 is used to merge the valid records in all data files, delete the invalid records in all data files, and obtain the merged result of the valid records.

[0140] In the above scheme,

[0141] An information processing module 2082, configured to determine a cloud server network corresponding to the database system according to identification information of the data of the database system;

[0142] The information processing module 2082 is used to store the update results of the data in the database system in the cloud server network;

[0143] The information processing module 2082 is used to send the update result to the database system through the cloud server network when data loss occurs in the database system.

[0144] according to Figure 2 The electronic device shown, in one aspect of the present application, the present application also provides a computer program product or a computer program, the computer program product or the computer program includes a computer instruction, and the computer instruction is stored in a computer-readable storage medium. The processor of the computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the different embodiments and combinations of embodiments provided in various optional implementations of the data processing method provided in the present application.

[0145] Combination Figure 2 The data processing device shown illustrates the data processing method provided by the embodiment of the present application, see Figure 3 , Figure 3 This is an optional flow chart of the data processing method provided in the embodiment of the present application. It can be understood that: Figure 3 The steps shown can be executed by various electronic devices running data processing devices, such as dedicated terminals, servers or server clusters with data processing devices, wherein the dedicated terminal with data processing devices can be the preceding Figure 2 The electronic device with data processing device in the embodiment shown. Figure 3 The steps shown are explained.

[0146] Step 301: The data processing device obtains structural information of a data storage engine in a database system; and configures data format information for the data storage engine based on the structural information.

[0147] The data processing method provided in this application is implemented based on the data storage engine provided in this application. The data storage engine provided in this application is a component that provides high-performance reading and writing of kv data structures, and can be embedded in other database servers to provide services for reading and writing kv data from disks. Figure 4 , Figure 4 This is a structural diagram of the data storage engine in an embodiment of the present invention, wherein the reading and writing of database records are performed through the database engine included in the data storage engine. The data storage engine provides the most basic read and write interface for reading and writing key-value (kv, key value) types, and the database records are stored in the engine file.

[0148] Step 302: The data processing device determines the data writing operation standard of the data storage engine according to the use requirements of the database, wherein the data writing operation standard is: writing data in log-type information and prohibiting data deletion.

[0149] In some embodiments of the present invention, reference Figure 5 , Figure 5FIG. 1 is a schematic diagram of structural information of a data storage engine in an embodiment of the present invention, wherein Figure 5 As shown, the data storage engine in this application processes data in two standards: one is the data writing standard, and the other is the data sorting standard. Specifically, the data writing operation standard of the data storage engine is determined according to the use requirements of the database. Unlike the Redis database system and Bitcask database system of the related technology, which allow data deletion, the data writing operation standard of the database system of this application is: write data in log-type information and prohibit data deletion; thus, all write operations of the data storage engine only append data without modifying the original data. The purpose of this is to ensure the maximum degree of sequential IO and improve the IO throughput of the storage engine. This can greatly reduce the workload of the CPU in I / O operations, allowing the CPU to work more efficiently.

[0150] Since the write operation standard writes data in log-type information, data files are written in log-type format and can only be increased but not decreased, and data files have a certain size limit. When the file size increases to the corresponding limit, a new file will be generated, and the original data file will be read-only but not write-able. At any point in time, only one data file is writable, so the accuracy of data writing can be guaranteed.

[0151] In some embodiments of the present invention, the data sorting standard of the data storage engine can be determined according to the use requirements of the database, wherein the data sorting standard is: deleting invalid data in the data storage engine and merging data files in the data storage engine. When eliminating holes, multiple data files may be merged into one, and the merging requires reverse updating of the record address in the hash bucket.

[0152] Specifically, since data files are read-only, they may contain invalid data. For example, after a record is modified, the new value will be written to the memory file, and the data in the file becomes invalid. After the record is deleted, there may be no hash index. Therefore, it is necessary to clean up the data file regularly to eliminate holes, and it is possible to merge multiple data files into one. The merger requires the reverse update of the record address in the hash bucket. In this way, the hash index in the memory adopts page management, which can improve the utilization of memory and reduce memory fragmentation and memory overhead.

[0153] Step 303: The data processing device determines the data file structure in the data storage engine based on the data format information.

[0154] Among them, when configuring the data storage engine provided by this application, it is necessary to determine the data file structure in the data storage engine according to the needs of the data storage engine, refer to Figure 6 , Figure 6Schematic diagram of the structure of a record in an embodiment of the present invention, wherein the record is a representation of a data file, and firstly, the version information of the data storage engine configuration record structure is determined based on the structure information; then, according to the version information of the record structure, the format information of different dimensions in the data storage engine is configured, such as Figure 6 As shown, the format information of different dimensions includes: 1) formatversion; version information of the record structure, 2) crc: CRC check information of the record header, 3) hash: hash value of the record key, 4) modtime: modification time of the record, 5) version: version information of the record, 6) ttl: lifetime of the record, 7) ksiz: size of the key, 8) vsiz: size of the value, 9) key: key for storing the record, 10) value: value for storing the record.

[0155] Finally, configure the magic number Magic for the data format information. The magic number is used to ensure the availability of the data through the data suffix name and determine whether the data file is a Class file that can be accepted by the virtual machine.

[0156] In some embodiments of the present invention, in order to ensure that the size of the data file is increased as much as possible, it is necessary to configure the data file structure in the data storage engine, referring to Figure 7 , Figure 7 Schematic diagram of a data file structure in an embodiment of the present invention, wherein: Figure 7 In the structure shown, records are stored in 8-byte format in the data file. The data file has a certain size limit. When the file size increases to the corresponding limit, the current file becomes read-only and a new file is generated for reading and writing. Figure 7 The data file 1 shown needs to be aligned so that each record in the data files 1 and 2 is aligned. The padding in the data file 1 refers to the space for alignment padding.

[0157] pass Figure 7 In the structure shown, record alignment can increase the addressing space. For example, in the current hash index, 27 bits are used to record the offset within a single file, so the maximum addressing space of a single file only supports 128M. If it is aligned to 8 bits, the addressing space can be 128M*8=1024M. In this way, the upper limit of the size of a single file can be increased.

[0158] Step 304: The data processing device configures a hash index for the data storage engine.

[0159] refer to Figure 8 , Figure 8This is a schematic diagram of a hash index in an embodiment of the present invention, in which the hash index uses a chain address method to resolve a hash table conflict, and the indexes in this storage engine are all stored in this hash table. Each hash record consists of 18 bytes, which stores the location information recorded in the data file, including the data file sequence number and the offset recorded in the data file.

[0160] like Figure 8 As shown, the index 0 in the array remains empty, and the hash bucket is 0, indicating that there is no data and the probability of hash conflict is low; the first 13 bits of kvoff store file_id, the last 27 bits store the offset in the file, and the seventh bit of flag indicates whether it is free; if the sixth bit is 1, then bits 5-0 store the total page of the record, which can represent up to 63 pages; if the sixth bit is 0, bits 5-4 store the key (maximum 8KB) on several 4kb aligned pages, up to 3; bits 3-0 store kv- on several 4kb aligned pages, which can represent up to 15 pages. Figure 8 In the hash structure shown, the key does not need to be stored in the index structure of the hash table. Compared with similar storage engines, the data storage engine provided by the present application can reduce the overhead of memory resources, so that the data storage engine can process a larger amount of data under the same memory resource overhead conditions.

[0161] The linked list address method used in this application uses a linked list array to store the corresponding data. When the hash encounters a conflict, it is added to the back of the linked list for processing. The process of chain address processing is as follows: when adding an element, first calculate the hash value of the element key to determine the position of insertion in the array. If there is no duplicate data at the current position, add it directly to the current position. When a conflict occurs, add it to the back of the element with the same hash value to form a linked list. The characteristic of this linked list is that the hash values ​​on the same linked list are the same.

[0162] When data is written, hash processing is performed according to the key field of the record: hash(key)%bucket_size, the corresponding bucket is found, and it is linked to the corresponding hash bucket in the chain address method.

[0163] When reading data, when providing the key field to read the record, the murmurhash algorithm is used to calculate the hash value according to the key, and the corresponding data record is quickly found and read by the chain address method.

[0164] When deleting data, when providing the key field to delete the record, the murmurhash algorithm is used to calculate the hash value according to the key, and the corresponding data record is quickly found by the chain address method to release the space for the record.

[0165] When traversing data, a reverse binary iteration algorithm is used. The highest position is always inverted first, the possibility of high positions is exhausted, and the low positions are pushed forward in sequence. This transformation method ensures that all elements will be traversed. Based on the data linked list address method, progressive rehashing can be achieved. Because it supports progressive hashing, the computational work required for the rehashing operation is distributed to the addition and deletion of hash indexes and self-scheduling when the engine is idle. Avoid the huge amount of computation brought by centralized rehashing and the risk of long-term blocking of access requests to the data storage engine.

[0166] After the data storage engine configuration is completed through steps 301 to 304, data access requests can continue to be received and operations matching the data access requests can be executed. The received data access requests include: write requests, read requests and delete requests, which are described below respectively.

[0167] Step 305: In response to the received data access request, the data processing device executes an operation matching the data access request according to the data file structure and the hash index to obtain a processing result of the data access request.

[0168] 1) The data access request is a read request

[0169] refer to Fig. 9 , Fig. 9 The following is a schematic diagram of a processing process when the data access request is a read request in an embodiment of the present invention, which specifically includes the following steps:

[0170] Step 901: Calculate a hash value according to the keyword of the read request; and determine a corresponding hash bucket according to the hash value.

[0171] Among them, the corresponding hash value can be calculated according to the key in the read request, and then the index of the hash bucket can be obtained according to the hash value, hash(key)%bucket_size, so as to find the hash bucket.

[0172] Step 902: Using the hash bucket, determine the data block required for the read request according to the offset and record size in the data file structure.

[0173] Among them, the position in the array can be found according to the value in the hash bucket, and the nodes in the linked list can be traversed; then the hash values ​​are compared, if they are different, continue to find the next, and if there is no next, it means that it is not found; if the hash values ​​are the same, the number of data blocks required is calculated according to the file offset parameter kvoff and the record size parameter size (the address is 4K aligned and the size is 4KB data block);

[0174] Step 903: Execute the read request according to the data block required by the read request, and obtain the processing result of the read request.

[0175] During execution, each data block is searched in turn to see if the first data block is in the memory. If so, the key information is read for comparison. If not, a data block is requested, the key is loaded and parsed from the disk, and the key is compared to see if it is found. If not found, it is returned to the array and the search continues in subsequent data blocks.

[0176] In actual implementation, in order to save the data corresponding to each klist scene, a storage structure for storing the data corresponding to the klist scene can be designed, see Fig.10 , Fig.10 1 is a schematic diagram of a storage structure of data provided in an embodiment of the present application. The storage structure shown in the figure includes a data node group (number 1), a data node associated with the node number of each data node group (number 2), and a plurality of data blocks corresponding to each data node (number 3).

[0177] To illustrate the data node group, in some embodiments, the server pre-initializes a memory area containing N elements (nodes), where N is an integer greater than 0. The object identifier (key value) of the target object is converted into an integer from 0 to N-1 through a mapping relationship f to determine the location of the corresponding memory area. It should be noted that the size of the pre-initialized memory area here is fixed.

[0178] In actual implementation, the memory area containing N elements can be regarded as a hash bucket, such as Fig.10 In the number 1, the hash bucket contains N elements. The corresponding hash algorithm h is set according to the actual situation. The object identifier (uid) of the target object is input into the hash algorithm h, and an integer result r is output, where 0≤r≤N-1, that is, r=h(uid).

[0179] For example, Fig.10 As shown, the object identifier 1, the object identifier 2 and the object identifier 3 shown in number 2 are all mapped to position 0 of the hash bucket shown in number 1 through the hash algorithm h.

[0180] Combination Fig.10 Continuing to explain the data nodes, the data nodes are obtained through mapping relationships. In actual implementation, when the object identifier is mapped to an integer between 0 and N through a hash algorithm, conflicts (hash conflicts) often occur. Fig.10 As shown, the object identifier 1, object identifier 2 and object identifier 3 shown in number 2 are all mapped to the position 0 of the hash bucket shown in number 1 through the hash algorithm h. In order to solve this conflict problem, each position element in the hash bucket is often made into a linked list. In this way, any position in the hash bucket can be linked to multiple object identifiers in the form of a linked list. Among them, any data node can be linked to multiple metadata blocks (also called child data nodes, such as Fig.10The data structure corresponding to the metadata block includes at least the object identifier of the target object, the total number of records of the target object's data to be stored, and at least one data block of storage location indication information.

[0181] In actual implementation, the type of each variable in the data structure can be set according to the actual situation and the program development language used.

[0182] For example, see Fig.11A , Fig.11A : is a schematic diagram of the data structure corresponding to the metadata block provided in the embodiment of the present application. In the figure, the metadata block is defined as a data structure dataNode of a structure type (struct) using C language. The structure includes at least an object identifier (uid) of a character type, a total number of records of an integer type (allcount), and a pointer type (dataBlock*data) pointing to the first data block.

[0183] To explain the data block, in some embodiments, the data pointer in each metadata block points to the first data block used to store the location indication information. Fig. 11B , Fig. 11B It is a schematic diagram of the data structure corresponding to the data block provided in the embodiment of the present application. The data structure shown in the figure includes at least the following variables: the used quantity (indicating the quantity of the position indication information stored in the current data block), the mark bit, the maximum value of the attribute of the primary key attribute, the minimum value of the attribute of the primary key attribute, and the position indication information corresponding to at least one data to be stored. It should be noted that the capacity threshold of each data block is the same, and the length of the mark bit is not less than the capacity threshold of the data block. In addition, the primary key attribute is at least one attribute included in the data to be stored of the target object, and the attribute value of the primary key attribute can be sorted, that is, the attribute value of the primary key attribute has a size relationship, or the attribute value has a time sequence relationship, etc., and the data to be stored can be sorted according to the attribute value of the primary key attribute.

[0184] In actual implementation, the type of each variable in the data structure corresponding to the data block can be set according to the actual situation and the actual program development language used, and a suitable primary key attribute can be selected from at least one attribute included in the data to be stored.

[0185] For example, see Fig. 11BIn the figure, the data block (datablock) is defined as a data structure dataBlock of a structure type (struct) using C language. The dataBlock structure includes at least a used count of a numeric type (usedcount), a tag bit of an array type (usedbitmap), a maximum value of a primary key attribute of a numeric type (tag_max), a minimum value of a primary key attribute of a numeric type (tag_min), and location indication information (dataItem*) corresponding to the data to be stored of a pointer array type. The size of the pointer array is set to 64, from which it can be seen that the capacity threshold of the data block is 64. It also indicates that the number of location indication information that can be stored in the data block is 64, as well as the pointer type (dataBlock*data) pointing to the next data block.

[0186] In some embodiments, the data node group used to store the location indication information is a fixed-size storage space, which avoids the allocation and release of dynamic memory. At the same time, the pre-allocated nodes can achieve a relatively high utilization rate in actual use. When the data node group contains N elements (data nodes), the object identifier of a single target object can be mapped to any one of the N elements of the data node group.

[0187] 2) Write request and delete request

[0188] In some embodiments of the present invention, Fig. 9 The processing steps of the read request are shown in Figure 2. To continue with the processing of write and delete requests, refer to Fig.12 , Fig.12 The schematic diagram of the processing process of a write request and a delete request in an embodiment of the present invention includes the following steps:

[0189] Step 904: When the data access request is a write request, serialize the write request.

[0190] During serialization, if the value length in the write request exceeds the value length threshold (the value length threshold is set according to the type of database, 8 bytes for medical information database and 4 bytes for entertainment information database), the value can be compressed using the snappy algorithm to save serialization processing time.

[0191] In actual implementation, the write thread of the server stores the attribute data of the data to be stored in the physical storage area of ​​the server, and determines the actual memory address corresponding to the target storage area.

[0192] It should be noted that the data stored in the target storage area at this time is serialized data obtained by serializing the attribute data of the data to be stored.

[0193] In actual implementation, the attribute data of the data to be stored is serialized, and the binary data transmission protocol in the related technology can be used to serialize the data. The embodiment of the present application does not limit the binary data transmission protocol.

[0194] Step 905: Align the records of the write request and configure the buffer.

[0195] The write request records can be aligned to 8 bytes, appended to the memory, and determine whether the current buffer is full. If only part of the data is appended, another buffer can be applied, the status of the previous buffer can be changed to read-only, and the buffer can be hung in the IO disk flushing queue. Then continue to write data to the newly applied buffer. This process may be triggered multiple times, such as writing 10MB of records

[0196] Step 906: Write the write request into the buffer of the data storage engine according to the data file structure.

[0197] Step 907: Update the address in the hash bucket according to the hash index.

[0198] Among them, after the write request is saved to the buffer, there is no need to wait for the data to fall to the disk. For example, when writing data, if the memory does not hit, there will be physical reads, and when transferring and merging, there will be intensive write IO when falling to the disk. These all rely on the disk read and write performance. Since the buffer is configured, the security of data storage can be guaranteed, and at the same time, it supports regular writing of hash indexes in memory to the disk. Therefore, the data storage engine of this application uses asynchronous IO to load hash indexes after restarting, and can quickly load metadata to start. Finally, update the address in the hash conflict array and hash bucket. If the same hash exists in the hash bucket, it is necessary to check whether it is the same key. If it is the same key, update the kvoff and other information of the record. If not, a new array subscript is allocated to store the record information.

[0199] Step 908: When the data access request is a delete request, search the hash conflict array for a record corresponding to the delete request;

[0200] Step 909: Delete the records in the hash conflict array.

[0201] Through step 908 and step 909, when deleting a record, it is only necessary to update the hash table index in the memory, and there is no need to append records to reduce disk IO, so hardware resources can also be saved.

[0202] Through step 305, operations matching the data access requests can be performed for read requests, write requests and delete requests to obtain processing results of the data access requests. When records in the storage engine are updated or deleted, invalid records will exist in the data file. Therefore, the data storage engine needs to eliminate invalid records in a timely manner through data sorting to release disk space.

[0203] In some embodiments of the present invention, the data processing device performs data sorting on the data storage engine and deletes invalid data records according to the processing result of the data access request, which can be achieved in the following ways:

[0204] According to the processing result of the data access request, all data files of the data storage engine are traversed to obtain the valid records and invalid records in all data files; the valid records in all data files are merged, and the invalid records in all data files are deleted to obtain the merged result of the valid records. Fig.13 , Fig.13 This is a schematic diagram of the data sorting process in an embodiment of the present invention. When there are invalid records in a data file, multiple data files will be merged into one, and the records in the hash index will be updated after the merger.

[0205] like Fig.13 As shown, data file 1 (DataFile1) DataFile1 has invalid records key_2 and key_3, and data file 2 (DataFile2) has invalid records key_b and key_c. After the write request and delete request are completed, there are holes in the data files and they need to be merged. Traverse all records of DataFile1 and DataFile2, and write valid records to DataFile3. DataFile1 and DataFile2 are merged into a new data file DataFile3. Data file 3 (DataFile3) contains the records key_1 and key_4 of the original DataFile1, and the records key_a and key_d of DataFile2. After the merge is completed, the index information in the hash index will continue to be updated, and the file id and file offset recorded in the hash index will be updated to the file id and file offset of DataFile3. Through Fig.13 The data sorting method shown can sort data in real time during the processing of write requests and delete requests, effectively reducing disk space overhead and saving users' database usage costs.

[0206] When the database system completes data synchronization, the cloud server network corresponding to the database system can be determined based on the identification information of the database system data; the update results of the database system data can be saved in the cloud server network; when data loss occurs in the database system, the update results can be sent to the database system through the cloud server network, thereby enhancing the data security of the database system and avoiding user losses caused by data loss in the database system.

[0207] Among them, the database system can be a cloud server or a cloud server cluster. The embodiments of the present application can be implemented in combination with cloud technology. Cloud technology refers to a hosting technology that unifies a series of resources such as hardware, software and network in a wide area network or a local area network to realize data calculation, storage, processing and sharing. It can also be understood as a general term for network technology, information technology, integration technology, management platform technology and application technology based on cloud computing business model applications. The backend services of the technical network system require a large amount of computing and storage resources, such as video websites, picture websites and more portal websites, so cloud technology needs to be supported by cloud computing.

[0208] It should be noted that cloud computing is a computing model that distributes computing tasks on a resource pool composed of a large number of computers, so that various application systems can obtain computing power, storage space and information services as needed. The network that provides resources is called the "cloud". From the user's point of view, the resources in the "cloud" can be infinitely expanded, and can be obtained at any time, used on demand, expanded at any time, and paid for by use. As a basic capability provider for cloud computing, a cloud computing resource pool platform will be established, referred to as a cloud platform, generally referred to as Infrastructure as a Service (IaaS), and various types of virtual resources will be deployed in the resource pool for external customers to choose to use. The cloud computing resource pool mainly includes: computing devices (which can be virtualized machines, including operating systems), storage devices and network devices.

[0209] Combined with the previous sequence Figure 1 As shown, the data processing method provided in the embodiment of the present invention can be implemented by corresponding cloud devices, for example: the terminal (including the terminal 10-1 and the terminal 10-2) is connected to the server 200 located in the cloud through the network 300, and the network 300 can be a wide area network or a local area network, or a combination of the two. It is worth noting that the server 200 can be a physical device or a virtualized device.

[0210] The data processing method provided by this application is further described below in combination with different implementation scenarios. With the explosive growth of game data, traditional relational databases are increasingly unable to meet the requirements of high concurrent reading and writing, efficient storage and access of massive data, high scalability and high availability. NoSQL databases have developed very rapidly due to their advantages such as simple expansion and fast reading and writing. Fig.14 , Fig.14 This is a schematic diagram of the architecture of the database system in this application. The database table is stored in the game database. Optionally, the game database includes TcaplusDB. The data storage protocols supported by the database table in TcaplusDB include the tdr protocol and the Protocol Buffers (pb) protocol. Due to the fragmentation of game time, there are many interactions between players, the amount of data is large, and both full-area and full-server and zone-based servers are very common. The game is developing and changing rapidly, and there are many operational activities. The data storage layer has high requirements for low latency. Therefore, the read requests, write requests, and delete requests in the database are not only large in number, but also instantaneous. Therefore, it is necessary not only to reduce memory fragmentation and memory overhead, but also to ensure the security and accuracy of data without occupying the hardware overhead of the database system, thereby reducing the user's usage cost.

[0211] Fig.14 In the structure shown, a TcaplusDB record consists of a line of strings. The numbers in each field support nested types, with a maximum of 32 levels of nesting. The maximum size of a single record is 10MB, and commonly used object files can be serialized into binary files for storage.

[0212] See also Fig.15 , Fig.15 This is a schematic diagram of the data processing method provided in this application. Fig.15 The data access request to be processed is shown in Table 1.

[0213] Table 1

[0214]

[0215]

[0216] Fig.15 The specific steps include:

[0217] Step 1501: Calculate the hash value according to the keyword of the read request 37000, search the hash bucket, and determine the data block required by the read request.

[0218] Step 1502: Execute the read request 37000 according to the data block required by the read request 37000.

[0219] Step 1503: Serialize write requests 37001 and 37002, align records, and configure buffers.

[0220] Step 1504: Keep the original data unchanged, write write requests 37001 and 37002 into the buffer of the data storage engine, and update the address in the hash bucket.

[0221] Step 1505: Find the corresponding records in the hash conflict array of deletion requests 37003 and 37004 and delete them.

[0222] Step 1506: Merge the records of valid requests 37000, 37001, and 37002.

[0223] Beneficial technical effects:

[0224] 1) The present application obtains structural information of a data storage engine in a database system; configures data format information for the data storage engine based on the structural information; determines the data file structure in the data storage engine based on the data format information; configures a hash index for the data storage engine; in response to a received data access request, performs an operation matching the data access request according to the data file structure and the hash index to obtain a processing result of the data access request; and processes the data access request using the hash index, thereby improving memory utilization and reducing memory fragmentation and memory overhead.

[0225] 2) According to the processing results of data access requests, the data storage engine is sorted and invalid data records are deleted, which can realize real-time data sorting, effectively reduce disk space overhead, and ensure data security and accuracy without occupying the hardware overhead of the database system, thereby reducing the user's usage cost.

[0226] 3) Since a buffer is configured, the security of data storage can be guaranteed, and the hash index in the memory can be written to the disk regularly. Therefore, after the data storage engine of this application is restarted, the hash index is loaded by asynchronous IO, and the metadata can be loaded quickly to start.

[0227] 4) Based on the data linked list address method, progressive rehashing can be achieved. Because it supports progressive hashing, the computational work required for the rehashing operation is distributed to the addition and deletion of hash indexes and self-scheduling when the engine is idle. This avoids the huge amount of computation brought by centralized rehashing and the risk of long-term blocking of access requests to the data storage engine.

[0228] The above are only embodiments of the present invention and are not intended to limit the protection scope of the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A data processing method, characterized in that: The method comprises: Acquire structural information of a data storage engine in a database system; configure data format information for the data storage engine based on the structural information; Determine the data writing operation standard of the data storage engine according to the use requirements of the database, wherein the data writing operation standard is: write data in log-type information and prohibit data deletion; Based on the data format information, determining a data file structure in the data storage engine; Configuring a hash index for the data storage engine; In response to the received data access request, an operation matching the data access request is performed according to the data file structure and the hash index to obtain a processing result of the data access request.

2. The method according to claim 1, characterized in that The method further comprises: Determine the data sorting standard of the data storage engine according to the use requirements of the database, wherein the data sorting standard is: delete invalid data in the data storage engine and merge data files in the data storage engine; According to the processing result of the data access request, the data storage engine is sorted and invalid data records are deleted.

3. The method according to claim 1, characterized in that Configuring data format information for the data storage engine based on the structure information includes: Determine version information of the data storage engine configuration record structure based on the structure information; According to the version information of the record structure, format information of different dimensions in the data storage engine is configured, wherein the format information of different dimensions includes: Cyclic redundancy check code, modification time of the record, version information of the record, hash value and size of the key value, and lifetime of the record; A magic number is configured for the data format information, wherein the magic number is used to ensure the availability of the data through a suffix name of the data.

4. The method according to claim 1, characterized in that Determining the data file structure in the data storage engine based on the data format information includes: Based on the data format information, determining a data storage volume in the data storage engine; Based on the data format information, an alignment of data in the data storage engine is determined.

5. The method according to claim 1, characterized in that In response to the received data access request, performing an operation matching the data access request according to the data file structure and the hash index to obtain a processing result of the data access request includes: When the data access request is a read request, calculating a hash value according to a keyword of the read request; Determine a corresponding hash bucket according to the hash value; Determine the data block required by the read request according to the offset and record size in the data file structure by using the hash bucket; The read request is executed according to the data block required by the read request to obtain a processing result of the read request.

6. The method according to claim 1, characterized in that In response to the received data access request, performing an operation matching the data access request according to the data file structure and the hash index to obtain a processing result of the data access request includes: When the data access request is a write request, serializing the write request; Aligning the records of the write request and configuring a buffer; Writing the write request into a buffer of the data storage engine according to the data file structure; According to the hash index, the address in the hash bucket is updated.

7. The method according to claim 1, characterized in that In response to the received data access request, performing an operation matching the data access request according to the data file structure and the hash index to obtain a processing result of the data access request includes: When the data access request is a deletion request, searching for a record corresponding to the deletion request in the hash collision array; Delete the records in the hash conflict array.

8. The method according to claim 1, characterized in that: The step of arranging data in the data storage engine and deleting invalid data records according to the processing result of the data access request includes: According to the processing result of the data access request, all data files of the data storage engine are traversed to obtain valid records and invalid records in all data files; Merge the valid records in all data files, delete the invalid records in all data files, and obtain the merged result of valid records.

9. The method according to claim 1, characterized in that: The method further comprises: Determining a cloud server network corresponding to the database system according to identification information of the data of the database system; The update result of the data of the database system is stored in the cloud server network; When data loss occurs in the database system, the update result is sent to the database system via the cloud server network.

10. A data processing device, characterized in that: The device comprises: An information transmission module, used to obtain structural information of a data storage engine in a database system; and configure data format information for the data storage engine based on the structural information; An information processing module determines the data file structure in the data storage engine based on the data format information; The information processing module is used to configure a hash index for the data storage engine; The information processing module is used to respond to the received data access request and perform an operation matching the data access request according to the data file structure and the hash index to obtain a processing result of the data access request; The information processing module is used to organize the data of the data storage engine and delete invalid data records according to the processing result of the data access request.

11. An electronic device, characterized in that: The electronic device comprises: A memory for storing executable instructions; A processor, configured to implement the data processing method according to any one of claims 1 to 9 when running the executable instructions stored in the memory.

12. A computer program product comprising a computer program or instructions, characterized in that When the computer program or instruction is executed by a processor, the data processing method according to any one of claims 1 to 9 is implemented.

13. A computer-readable storage medium storing executable instructions, characterized in that: When the executable instructions are executed by a processor, the data processing method according to any one of claims 1 to 9 is implemented.

Citation Information

Patent Citations

  • Cross-platform efficient key value storage method

    CN111639076A

  • Database engine file processing method and device

    CN112732702A

  • Method for managing records, its executing device and its processing program

    JP2003022202A