A data storage method, device, electronic equipment and storage medium

By using hash encoding on the server to store data in volatile and persistent memory, the problem of data loss when the server crashes or restarts is solved, improving data reading efficiency and business execution efficiency.

CN115878605BActive Publication Date: 2026-01-23BEIJING SANKUAI ONLINE TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111137969.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-27
Publication Date
2026-01-23
Estimated Expiration
2041-09-27

AI Technical Summary

Technical Problem

In existing technologies, when a server crashes or restarts, all data in memory is lost, resulting in excessively long data loading times and impacting business execution efficiency.

Method used

Hash encoding is used to store data in volatile memory and persistent memory. Related data can be queried using the first key and the second key, and the related data and the second key are stored continuously in persistent memory to ensure that the data is not lost when the server restarts or crashes.

Benefits of technology

This allows data to be read without reloading when the server restarts or crashes, improving data reading efficiency, reducing data loading time, and enhancing the server's business execution efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115878605B_ABST
    Figure CN115878605B_ABST
Patent Text Reader

Abstract

The specification discloses a data storage method, device, electronic equipment and storage medium. A server acquires service-related data, the service-related data including first data, second data and associated data. Then, a first keyword is determined according to part of the first data, and a second keyword is determined according to other data and the second data. A first hash code corresponding to the first keyword is determined, a hash table address corresponding to the first keyword stored in a first storage unit is determined, a second hash code corresponding to the second keyword is determined, and a physical space in a second storage unit is determined according to the hash table address and the second hash code. Finally, the second keyword and the associated data are combined as a data group and stored in the physical space. The second storage unit is a persistent memory, and the physical spaces corresponding to the data groups in the second storage unit are continuous, thereby reducing the data loading time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This specification relates to the field of computer technology, and in particular to a method, apparatus, electronic device and storage medium for data storage. Background Technology

[0002] In internet businesses, business platforms often need to store large amounts of data locally on servers to support business operations, and retrieve the required data from the local server during business execution. For example, delivery services need to pre-store navigation distances between various geographical locations and retrieve the corresponding navigation distances as needed during delivery scheduling. Similarly, real-time delivery scheduling and information recommendation services need to store order characteristics and user characteristics. If user characteristics are required in the business, they can be identified through user identifiers.

[0003] In existing technologies, business platforms can load the required data into the server's local memory, namely Dynamic Random Access Memory (DRAM). When data needs to be queried, the server can retrieve the corresponding data from memory. However, due to the characteristics of DRAM, if the server crashes or restarts, all data in memory will be lost. The server needs to reload the data into memory, and this data is usually large in size, so the data loading process takes too long.

[0004] Therefore, how to avoid excessively long data loading times is an urgent problem to be solved. Summary of the Invention

[0005] This specification provides a data storage method, apparatus, electronic device, and storage medium to partially solve the aforementioned problems existing in the prior art.

[0006] The following technical solution is adopted in this specification:

[0007] This specification provides a method for data storage, including:

[0008] Acquire business-related data, which includes first data, second data, and associated data, wherein the associated data is determined by the first data and the second data;

[0009] Based on a portion of the data in the first data, a first keyword is determined; based on the other data in the first data excluding the aforementioned portion of data and the second data, a second keyword is determined; the first keyword and the second keyword are used together to query the associated data.

[0010] Determine the hash code corresponding to the first key as the first hash code, and determine the hash table address stored in the first storage unit corresponding to the first key based on the first hash code;

[0011] Determine the hash code corresponding to the second key as the second hash code, and determine the physical space in the second storage unit for storing the second key and the associated data based on the hash table address and the second hash code;

[0012] The second keyword and the associated data are stored as a data combination in the physical space, wherein the first storage unit is volatile memory, the second storage unit is persistent memory, and the physical spaces corresponding to each data combination in the second storage unit are contiguous.

[0013] Optionally, the second keyword and the associated data are stored as a data combination in the physical space, specifically including:

[0014] If it is determined that the physical space has been occupied by other data combinations, query the free physical spaces located after the physical space in sequence;

[0015] The combined data is stored in the free physical space.

[0016] Optionally, based on the first hash code, the address of the hash table stored in the first storage unit corresponding to the first key is determined, specifically including:

[0017] If it is determined that the first key is not stored in the storage location corresponding to the first hash code in the first storage unit, the hash table address in the second storage unit corresponding to the first key is determined, and the hash table address is stored in the first storage unit in accordance with the storage location corresponding to the first key;

[0018] If it is determined that the first key has been stored in the storage location corresponding to the first hash code in the first storage unit, the address of the hash table stored in the first storage unit corresponding to the first key is determined.

[0019] Optionally, determining the hash table address stored in the first storage unit corresponding to the first key based on the first hash code specifically includes:

[0020] Determine the data location corresponding to the first hash code in the hash table of the first storage unit;

[0021] Based on the data location, determine the address of the hash table stored in the first storage unit that corresponds to the first key.

[0022] Optionally, the method further includes:

[0023] If a query request for the associated data is received, the first keyword and the second keyword are obtained;

[0024] Determine the first hash code corresponding to the first key and the second hash code corresponding to the second key;

[0025] Based on the first hash code, determine the hash table address where the first storage unit corresponds to the first key;

[0026] Based on the hash table address and the second hash code, determine the physical space in the second storage unit used to store the second key and the associated data, and use it as the target physical space;

[0027] Based on the target physical space, determine the first data following the second keyword to obtain the retrieved associated data.

[0028] Optionally, based on the target physical space, the first data following the second keyword is determined to obtain the retrieved associated data, specifically including:

[0029] If the second keyword does not match the keyword in the target physical space, query each physical space after the target physical space in turn until the physical space storing the second keyword is found.

[0030] The first data following the first keyword in the physical space where the second keyword is stored is determined, and the queried data is obtained.

[0031] Optionally, the first data is the location code of the starting point, the second data is the location code of the ending point, the associated data is the navigation distance between the starting point and the ending point, the first keyword includes a partial location code corresponding to the starting point, the second keyword includes other location codes in the starting point besides the partial location code, and the location code corresponding to the ending point.

[0032] This specification provides a data storage device, comprising:

[0033] The acquisition module is configured to acquire business-related data, which includes first data, second data, and associated data. The associated data is determined by the first data and the second data.

[0034] The keyword determination module is configured to determine a first keyword based on a portion of the first data, and to determine a second keyword based on the other data in the first data excluding the portion of data and the second data, wherein the first keyword and the second keyword are used together to query the associated data;

[0035] The encoding determination module is configured to determine the hash code corresponding to the first key as the first hash code, and determine the hash table address stored in the first storage unit corresponding to the first key based on the first hash code;

[0036] The space determination module is configured to determine the hash code corresponding to the second key as the second hash code, and determine the physical space in the second storage unit for storing the second key and the associated data based on the hash table address and the second hash code.

[0037] A storage module is configured to store the second keyword and the associated data as data combinations in the physical space, wherein the second storage unit is persistent memory, the physical space corresponding to each data combination in the second storage unit is contiguous, and the first storage unit is volatile memory.

[0038] This specification provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described method for data storage.

[0039] This specification provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the aforementioned data storage method.

[0040] The above-mentioned technical solutions adopted in this specification can achieve the following beneficial effects:

[0041] In the data storage method provided in this specification, the server can obtain business-related data, which includes first data, second data, and associated data. Associated data can be determined from the first and second data. Then, a first key can be determined based on a portion of the first data, and a second key can be determined based on the remaining data in the first data (excluding the portion) and the second data. The first and second keys are used together to query the associated data. The hash code corresponding to the first key is determined as the first hash code. Based on the first hash code, the address of the hash table corresponding to the first key in the first storage unit is determined, and the hash code corresponding to the second key is determined as the second hash code. Based on the hash table address and the second hash code, the physical space in the second storage unit used to store the second key and the associated data is determined. Finally, the second key and the associated data are stored as a data combination in the physical space. The first storage unit is volatile memory, the second storage unit is persistent memory, and the physical spaces corresponding to each data combination in the second storage unit are contiguous.

[0042] As can be seen from the above method, when storing the second key and associated data, the server can store the second key and associated data in persistent memory space and make their physical addresses contiguous. By storing the data in persistent memory space, even if the server restarts or crashes, it does not need to reload the data. Furthermore, since the server needs to read a large data block at once when reading data through persistent memory space, making the physical addresses of the second key and associated data contiguous can also ensure the efficiency of the server reading data to a certain extent. Attached Figure Description

[0043] The accompanying drawings, which are included to provide a further understanding of this specification and form part of this specification, illustrate exemplary embodiments and are used to explain this specification, but do not constitute an undue limitation thereof. In the drawings:

[0044] Figure 1 This is a flowchart illustrating a data storage method described in this specification.

[0045] Figure 2 This is a schematic diagram illustrating the storage location of each associated data and its corresponding second key, as provided in this specification.

[0046] Figure 3 This is a schematic diagram illustrating the determination of free physical space as provided in this specification;

[0047] Figure 4 This is a schematic diagram illustrating the relationship between the first keyword, the second keyword, and related data provided in this specification.

[0048] Figure 5 A schematic diagram of a data storage device provided in this specification;

[0049] Figure 6 This specification provides a corresponding Figure 1 A schematic diagram of an electronic device. Detailed Implementation

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

[0051] The technical solutions provided in the various embodiments of this specification are described in detail below with reference to the accompanying drawings.

[0052] Figure 1 This is a flowchart illustrating a data storage method described in this specification, including the following steps:

[0053] S101: Obtain business-related data, which includes first data, second data, and associated data, and the associated data is determined by the first data and the second data.

[0054] S102: Based on a portion of the data in the first data, determine a first keyword; based on the other data in the first data excluding the portion of data and the second data, determine a second keyword; the first keyword and the second keyword are used together to query the associated data.

[0055] In practical applications, to facilitate the retrieval of business-related data, the server can store the business-related data locally after it has been identified. Based on this, the server can retrieve the business-related data, which may include first data, second data, and related data. A first keyword can be determined based on a portion of the first data, and a second keyword can be determined based on the remaining data in the first data (excluding the first portion) and the second data. The first and second keywords can be used together to query the related data.

[0056] In this context, associated data can refer to navigation distance. The first data can be the location code of the starting point, and the second data can be the location code of the ending point. In other words, the data storage method described in this specification can be applied to scenarios involving querying navigation distances from a delivery origin to a delivery destination. When the server needs to query the navigation distance from a starting point to a destination, it can use the location code corresponding to the starting point and the first and second keywords of the ending point. Specifically, associated data refers to the data that needs to be queried from business-related data. Associated data can be determined using the first and second data, and the first and second keywords are determined using the first and second data. Therefore, associated data can be retrieved using the first and second keywords. For example, if the associated data is navigation distance, the first data can be the location code of the starting point (e.g., geohash code), and the second data can be the location code of the ending point. The first keyword can include a portion of the location code of the starting point, and the second keyword can include the remaining location code of the starting point and the location code of the ending point.

[0057] S102: Determine the hash code corresponding to the first key as the first hash code, and determine the hash table address stored in the first storage unit corresponding to the first key based on the first hash code.

[0058] S103: Determine the hash code corresponding to the second key as the second hash code, and determine the physical space in the second storage unit for storing the second key and the associated data based on the hash table address and the second hash code.

[0059] S104: The second keyword and the associated data are stored as a data combination in the physical space, wherein the first storage unit is volatile memory, the second storage unit is persistent memory, and the physical spaces corresponding to each data combination in the second storage unit are contiguous.

[0060] After determining the first key and the second key, the server can determine the hash code corresponding to the first key as the first hash code. Based on the first hash code, it determines the address of the hash table stored in the first storage unit corresponding to the first key, and determines the hash code corresponding to the second key as the second hash code. Based on the hash table address and the second hash code, it determines the physical space in the second storage unit used to store the second key and associated data. Then, the second key and associated data can be stored as a data combination in this physical space. The first storage unit is volatile memory, the second storage unit is persistent memory, and the physical space corresponding to each data combination in the second storage unit is contiguous.

[0061] The hash table address stored in the first storage unit corresponding to the first key mentioned above can refer to a physical address pointing to the second storage unit. Based on this physical address, the hash table containing the second key and associated data in the second storage unit can be determined. In practical applications, there may be multiple cases where the first key corresponding to multiple pieces of associated data is the same. Therefore, when the same first key is obtained repeatedly, it is not necessary to re-store the first key; it is only necessary to determine the hash table address corresponding to that first key.

[0062] Specifically, if the server determines that the first key is not stored in the storage location corresponding to the first hash code in the first storage unit, it determines the hash table address in the second storage unit corresponding to the first key, and stores the hash table address and the first key in the first storage unit according to the storage location. If the server determines that the first key is stored in the storage location corresponding to the first hash code in the first storage unit, it can directly determine the hash table address stored in the first storage unit corresponding to the first key.

[0063] The associated data and the second key are stored in persistent memory. Even if the server restarts, the associated data and the second key will not be lost and do not need to be reloaded. Furthermore, the physical storage addresses of an associated data item and its corresponding second key are contiguous, and the physical space storing each data combination (i.e., associated data and second key) is contiguous, such as... Figure 2 As shown.

[0064] Figure 2 This is a schematic diagram illustrating the storage location of each associated data and its corresponding second key, as provided in this specification.

[0065] from Figure 2 As can be seen, the physical spaces corresponding to data combination A, data combination B, and data combination C are continuous. The second key A in data combination A is the second key corresponding to the associated data A, and so on. The second key B in data combination B is the second key corresponding to the associated data B, and the second key C in data combination C is the second key corresponding to the associated data C. It can be seen that the physical addresses between the associated data and the second key corresponding to the associated data are also continuous.

[0066] Because persistent memory (PMEM) can read multiple consecutive data blocks (cache lines) at once compared to DRAM (for example, PMEM can read four cache lines at a time, i.e., 256 bytes of data at a time, while DRAM can read one cache line at a time), storing the associated data and the second key consecutively in the second storage unit (i.e., the physical addresses of the associated data and the second key are contiguous) ensures that the server can read the associated data corresponding to the second key when reading the second key, thus ensuring the server's read efficiency. Furthermore, as mentioned later, if the physical space where the associated data determined by the second key should be stored is occupied, free physical space can be determined by looking further ahead. Therefore, in summary, making the physical space corresponding to each associated data consecutive can improve the server's data read efficiency to a certain extent.

[0067] It should be noted that when storing the second key and associated data on the server, the hash code of the determined second key is used to determine which physical space should store the second key and associated data. However, in practice, there may be cases where different second keys result in the same hash code. In this case, when storing the second second key and its corresponding associated data, the physical space that should be used to store the second key and its corresponding associated data is already occupied. Therefore, it is necessary to determine another physical space to store the second key and its corresponding associated data.

[0068] Based on this, if the physical space determined by the second hash code is already occupied by other data combinations, the server can sequentially query the free physical space following that physical space and store the data combination in that physical space. Free physical space can refer to the first free physical space after the physical space whose physical address is located, such as... Figure 3 As shown.

[0069] Figure 3 This is a schematic diagram illustrating the determination of free physical space provided in this specification.

[0070] from Figure 3 As can be seen, associated data A has been stored in the hash table. Associated data B needs to be stored in the hash table. However, the physical space determined by the hash encoding of the second key B corresponding to associated data B is the same as the physical space where associated data A is located. In other words, the physical space has been occupied by the data combination corresponding to associated data A. Therefore, it is necessary to determine the first free physical space after the physical space to serve as the physical space for storing associated data B and the second key B.

[0071] The reason for storing the first keyword, the second keyword, and the associated data is to facilitate subsequent business queries. Therefore, if the server receives a query request for the associated data, it can obtain the first keyword and the second keyword, determine the first hash code corresponding to the first keyword and the second hash code corresponding to the second keyword, and determine the hash table address of the first storage unit corresponding to the first keyword based on the first hash code. Based on the hash table address and the second hash code, it determines the physical space in the second storage unit used to store the second keyword and the associated data as the target physical space. Based on the target physical space, it determines the first data after the second keyword to obtain the queried associated data.

[0072] In other words, when querying the associated data, the hash code of the first key corresponding to the associated data can be determined, thereby determining the position of the first key in the hash table of the first storage unit, and thus determining the hash table where the associated data is located in the second storage unit. Then, by using the hash code of the second key, the position of the associated data in that hash table (the hash table in the second storage unit) can be determined, so as to query the associated data. Since the associated data and the second key are stored contiguously, after querying the second key, the data after the second key can be directly used as the associated data.

[0073] Correspondingly, when the server performs a query, it also needs to consider the possibility that the physical space mentioned above is occupied by other data combinations. Therefore, if the second keyword does not match the keyword in the target physical space, each physical space after the target physical space is queried sequentially until the physical space storing the second keyword is found. The first data after the first keyword in the physical space storing the second keyword is then determined, and the queried data is obtained. In other words, if the keyword stored in the physical space does not match the second keyword, each physical space after the first keyword can be queried sequentially until the physical space storing the first keyword is found, thereby determining the first data after the keyword in that physical space and obtaining the queried related data. Figure 3 For example.

[0074] It should be noted that the first key can include the first 20 digits of the position code of the starting position, and the second key can include the last 20 digits of the position code of the starting position and the complete position code of the ending position. In addition, in order to efficiently determine the hash code, the first data key and the second data key can be stored as numeric types (such as integer int, long integer, etc.).

[0075] In summary, by using the hash table address corresponding to the first key and the second hash code corresponding to the second key, the physical space of the second key and the associated data in the hash table corresponding to that hash table address can be determined. That is, the physical space in the second storage unit can be determined. In other words, the location of the associated data needs to be determined by both the first and second keys. Figure 4 As shown.

[0076] Figure 4 This is a schematic diagram illustrating the relationship between a first keyword, a second keyword, and associated data, as provided in this specification.

[0077] from Figure 4 As can be seen, a primary key can correspond to multiple different associated data. Therefore, it is necessary to determine the secondary key and the hash table address of the hash table where the associated data is located through the primary key, and then find the associated data through the secondary key.

[0078] As can be seen from the above method, when storing the second key and associated data, the server can store the second key and associated data in persistent memory space and make their physical addresses contiguous. By storing the data in persistent memory space, even if the server restarts or crashes, it does not need to reload the data. Furthermore, since the server needs to read a large data block at once when reading data through persistent memory space, making the physical addresses of the second key and associated data contiguous can also ensure the efficiency of the server in reading data to a certain extent.

[0079] The above describes data storage methods provided by one or more embodiments of this specification. Based on the same concept, this specification also provides corresponding data storage devices, such as... Figure 5 As shown.

[0080] Figure 5 A schematic diagram of a data storage device provided in this specification includes:

[0081] The acquisition module 501 is configured to acquire business-related data, which includes first data, second data, and associated data. The associated data is determined by the first data and the second data.

[0082] The keyword determination module 502 is configured to determine a first keyword based on a portion of the first data, and to determine a second keyword based on the other data in the first data excluding the portion of data and the second data, wherein the first keyword and the second keyword are used together to query the associated data;

[0083] The encoding determination module 503 is configured to determine the hash code corresponding to the first key as the first hash code, and determine the hash table address stored in the first storage unit corresponding to the first key based on the first hash code;

[0084] The space determination module 504 is configured to determine the hash code corresponding to the second key as the second hash code, and determine the physical space in the second storage unit for storing the second key and the associated data based on the hash table address and the second hash code.

[0085] Storage module 505 is configured to store the second keyword and the associated data as a data combination in the physical space, wherein the second storage unit is persistent memory, the physical space corresponding to each data combination in the second storage unit is contiguous, and the first storage unit is volatile memory.

[0086] Optionally, the storage module 505 is specifically used to: if it is determined that the physical space has been occupied by other data combinations, sequentially query the free physical space located after the physical space; and store the data combination in the free physical space.

[0087] Optionally, the encoding determination module 503 is specifically used to: if it is determined that the first key is not stored in the storage location corresponding to the first hash code in the first storage unit, determine the hash table address in the second storage unit corresponding to the first key, and store the hash table address and the first key in the first storage unit according to the storage location; if it is determined that the first key is stored in the storage location corresponding to the first hash code in the first storage unit, determine the hash table address stored in the first storage unit corresponding to the first key.

[0088] Optionally, the encoding determination module 503 is specifically used to determine the data position corresponding to the first hash code in the hash table of the first storage unit; and determine the hash table address stored in the first storage unit corresponding to the first key based on the data position.

[0089] Optionally, the device further includes:

[0090] The query module 506 is configured to, upon receiving a query request to query the associated data, obtain the first keyword and the second keyword; determine the first hash code corresponding to the first keyword and the second hash code corresponding to the second keyword; determine the hash table address corresponding to the first keyword stored in the first storage unit based on the first hash code; determine the physical space in the second storage unit used to store the second keyword and the associated data as the target physical space based on the hash table address and the second hash code; and determine the first data following the second keyword based on the target physical space to obtain the queried associated data.

[0091] Optionally, the query module 506 is specifically used to: if the second keyword is inconsistent with the keyword in the target physical space, query each physical space after the target physical space in turn until the physical space storing the second keyword is found; determine the first data after the first keyword in the physical space storing the second keyword, and obtain the queried data.

[0092] Optionally, the first data is the location code of the starting point, the second data is the location code of the ending point, the associated data is the navigation distance between the starting point and the ending point, the first keyword includes a partial location code corresponding to the starting point, the second keyword includes other location codes in the starting point besides the partial location code, and the location code corresponding to the ending point.

[0093] This specification also provides a computer-readable storage medium storing a computer program that can be used to execute the above-described... Figure 1 This provides a method for data storage.

[0094] This instruction manual also provides Figure 6 One of the corresponding Figure 1 A schematic diagram of the structure of an electronic device. (e.g.) Figure 6 At the hardware level, the electronic device includes a processor, internal bus, network interface, memory, and non-volatile memory, and may also include other hardware required for the business operations. The processor reads the corresponding computer program from the non-volatile memory into memory and then runs it to achieve the above-mentioned functions. Figure 1 The data storage method described herein. Of course, in addition to software implementation, this specification does not exclude other implementation methods, such as logic devices or a combination of hardware and software, etc. That is to say, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.

[0095] In the 1990s, improvements to a technology could be clearly distinguished as either hardware improvements (e.g., improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the methodology). However, with technological advancements, many methodological improvements today can be considered direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved methodology into the hardware circuit. Therefore, it cannot be said that a methodological improvement cannot be implemented using hardware physical modules. For example, a Programmable Logic Device (PLD) (such as a Field Programmable Gate Array (FPGA)) is such an integrated circuit whose logic function is determined by the user programming the device. Designers can program and "integrate" a digital system onto a PLD themselves, without needing chip manufacturers to design and manufacture dedicated integrated circuit chips. Furthermore, nowadays, instead of manually manufacturing integrated circuit chips, this programming is mostly implemented using "logic compiler" software. Similar to the software compiler used in program development, the original code before compilation must be written in a specific programming language, called a Hardware Description Language (HDL). There are many HDLs, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, and RHDL (Ruby Hardware Description Language). Currently, the most commonly used are VHDL (Very-High-Speed ​​Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should understand that by simply performing some logic programming on the method flow using one of these hardware description languages ​​and programming it into an integrated circuit, the hardware circuit implementing the logical method flow can be easily obtained.

[0096] The controller can be implemented in any suitable manner. For example, it can take the form of a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro)processor, logic gates, switches, application-specific integrated circuits (ASICs), programmable logic controllers, and embedded microcontrollers. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicon Labs C8051F320. A memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art will also recognize that, in addition to implementing the controller in purely computer-readable program code form, the same functionality can be achieved by logically programming the method steps to make the controller take the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers. Therefore, such a controller can be considered a hardware component, and the means included therein for implementing various functions can also be considered as structures within the hardware component. Alternatively, the means for implementing various functions can be considered as both software modules implementing the method and structures within the hardware component.

[0097] The systems, devices, modules, or units described in the above embodiments can be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, a computer can be, for example, a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email device, game console, tablet computer, wearable device, or any combination of these devices.

[0098] For ease of description, the above devices are described in terms of function, divided into various units. Of course, in implementing this specification, the functions of each unit can be implemented in one or more software and / or hardware components.

[0099] Those skilled in the art will understand that embodiments of this specification can be provided as methods, systems, or computer program products. Therefore, this specification may take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this specification may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0100] This specification is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this specification. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create a machine for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0101] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0102] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0103] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0104] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.

[0105] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.

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

[0107] Those skilled in the art will understand that the embodiments of this specification can be provided as methods, systems, or computer program products. Therefore, this specification may take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this specification may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0108] This specification can be described in the general context of computer-executable instructions that are executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform a specific task or implement a specific abstract data type. This specification can also be practiced in distributed computing environments, where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.

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

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

Claims

1. A method for data storage, characterized in that, include: Acquire business-related data, which includes first data, second data, and associated data, wherein the associated data is determined by the first data and the second data; Based on a portion of the data in the first data, a first keyword is determined; based on the other data in the first data excluding the aforementioned portion of data and the second data, a second keyword is determined; the first keyword and the second keyword are used together to query the associated data. Determine the hash code corresponding to the first key as the first hash code, and determine the hash table address stored in the first storage unit corresponding to the first key based on the first hash code; Determine the hash code corresponding to the second key as the second hash code, and determine the physical space in the second storage unit for storing the second key and the associated data based on the hash table address and the second hash code; The second keyword and the associated data are stored as a data combination in the physical space, wherein the first storage unit is volatile memory, the second storage unit is persistent memory, and the physical spaces corresponding to each data combination in the second storage unit are contiguous.

2. The method as described in claim 1, characterized in that, The second keyword and the associated data are combined and stored in the physical space, specifically including: If it is determined that the physical space has been occupied by other data combinations, query the free physical spaces located after the physical space in sequence; The combined data is stored in the free physical space.

3. The method as described in claim 1, characterized in that, Based on the first hash code, determine the address of the hash table stored in the first storage unit corresponding to the first key, specifically including: If it is determined that the first key is not stored in the storage location corresponding to the first hash code in the first storage unit, the hash table address in the second storage unit corresponding to the first key is determined, and the hash table address is stored in the first storage unit in accordance with the storage location corresponding to the first key; If it is determined that the first key has been stored in the storage location corresponding to the first hash code in the first storage unit, the address of the hash table stored in the first storage unit corresponding to the first key is determined.

4. The method as described in claim 1, characterized in that, Based on the first hash code, the address of the hash table stored in the first storage unit corresponding to the first key is determined, specifically including: Determine the data location corresponding to the first hash code in the hash table of the first storage unit; Based on the data location, determine the address of the hash table stored in the first storage unit that corresponds to the first key.

5. The method as described in claim 1, characterized in that, The method further includes: If a query request for the associated data is received, the first keyword and the second keyword are obtained; Determine the first hash code corresponding to the first key and the second hash code corresponding to the second key; Based on the first hash code, determine the hash table address where the first storage unit corresponds to the first key; Based on the hash table address and the second hash code, determine the physical space in the second storage unit used to store the second key and the associated data, and use it as the target physical space; Based on the target physical space, determine the first data following the second keyword to obtain the retrieved associated data.

6. The method as described in claim 5, characterized in that, Based on the target physical space, the first data following the second keyword is determined to obtain the retrieved associated data, specifically including: If the second keyword does not match the keyword in the target physical space, query each physical space after the target physical space in turn until the physical space storing the second keyword is found. The first data following the first keyword in the physical space where the second keyword is stored is determined, and the queried data is obtained.

7. The method according to any one of claims 1 to 6, characterized in that, The first data is the location code of the starting position, the second data is the location code of the ending position, the associated data is the navigation distance between the starting position and the ending position, the first keyword includes a partial location code corresponding to the starting position, the second keyword includes other location codes in the starting position besides the partial location code, and the location code corresponding to the ending position.

8. A data storage device, characterized in that, include: The acquisition module is configured to acquire business-related data, which includes first data, second data, and associated data. The associated data is determined by the first data and the second data. The keyword determination module is configured to determine a first keyword based on a portion of the first data, and to determine a second keyword based on the other data in the first data excluding the portion of data and the second data, wherein the first keyword and the second keyword are used together to query the associated data; The encoding determination module is configured to determine the hash code corresponding to the first key as the first hash code, and determine the hash table address stored in the first storage unit corresponding to the first key based on the first hash code; The space determination module is configured to determine the hash code corresponding to the second key as the second hash code, and determine the physical space in the second storage unit for storing the second key and the associated data based on the hash table address and the second hash code. A storage module is configured to store the second keyword and the associated data as data combinations in the physical space, wherein the second storage unit is persistent memory, the physical space corresponding to each data combination in the second storage unit is contiguous, and the first storage unit is volatile memory.

9. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, which, when executed by a processor, implements the method described in any one of claims 1 to 7.

10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the method described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Data updating method for storage nodes in distributed storage system

    CN111274259A

  • Method for searching objects in a database

    US20130066880A1