A data storage address query method, device, equipment and medium

By using multiple linear shift registers and Walsh orthogonal code groups to generate multiple hash results, combined with hash table row and column indexes, the hash collision problem in data storage address lookup is solved, improving query efficiency and accuracy.

CN115269602BActive Publication Date: 2026-01-09CHINA TELECOM CLOUD TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210907767.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-29
Publication Date
2026-01-09
Estimated Expiration
2042-07-29

AI Technical Summary

Technical Problem

Existing technologies suffer from hash collisions in data storage address lookups, resulting in long computation times and a lack of effective solutions.

Method used

Multiple linear shift registers and Walsh orthogonal code groups are used to generate multiple hash results with different initial values ​​and m sequences. The orthogonality of the hash results is used to reduce the probability of collisions, and the target address is determined by combining the row and column indices of the hash table.

Benefits of technology

It effectively reduces the possibility of hash collisions, improves the efficiency and accuracy of data storage address lookup, and reduces computation time latency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115269602B_ABST
    Figure CN115269602B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a data storage address query method, device and equipment and medium, which are used to reduce the generation of hash conflicts in the data storage address query process. The method comprises the following steps: in response to an instruction for querying a storage address, inputting a target key value corresponding to the instruction into a plurality of linear shift registers to obtain corresponding output sequences, wherein the initial values of the linear shift registers used each time are different; determining a first hash result corresponding to the target key value according to the first M1 output sequences, and determining a second hash result corresponding to the target key value according to the last M2 output sequences; determining the position of the target hash result in a hash table according to the first hash result and the second hash result, and obtaining a corresponding target pointer from the corresponding position; and determining the storage address of the target key value from a key value table according to the target pointer.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of data processing, and particularly relates to a data storage address query method and device, equipment and a medium. BACKGROUND

[0002] At present, a hash table is a commonly used data management method, and data is stored in the form of a key-value pair in the hash table. When data processing is performed, a data reverse lookup address function is often used, that is, given a key value, the address of the key value needs to be obtained. For example, in CACHE processing, a computer obtains corresponding data from the CACHE, and whether a hit is found in a data center.

[0003] When an address is queried, hash calculation is often used to convert the given key value into the address to be searched. However, since the length of the key value is usually greater than the length of the address, that is, the length of the input data is greater than the length of the output data, hash collision and other problems inevitably exist.

[0004] At present, when the above-mentioned hash collision problem is solved by using a rehash method, although the calculation is relatively simple, since two hash calculations need to be performed, the calculation time is relatively long, which leads to an increase in time delay. Therefore, there is currently no method that can quickly and effectively reduce the generation of hash collisions in the address query process. SUMMARY

[0005] The present application provides a data storage address query method, device, equipment and medium, which effectively reduces the probability of hash collision in the key value storage address query process.

[0006] In a first aspect of the embodiments of the present application, a data storage address query method is provided, comprising:

[0007] In response to an instruction for querying a storage address, a target key value corresponding to the instruction is input into a plurality of linear shift registers to obtain corresponding output sequences, wherein the initial value of the linear shift register used each time is different, and the coefficients of each linear shift register are determined according to a primitive polynomial of an m sequence (the longest linear shift register sequence);

[0008] A first hash result corresponding to the target key value is determined according to the first M1 output sequences, and a second hash result corresponding to the target key value is determined according to the last M2 output sequences, wherein the sum of M1 and M2 is the number of obtained output sequences;

[0009] The position of the target hash result corresponding to the target key value in the hash table is determined according to the first hash result and the second hash result, and a corresponding target pointer is obtained from the position;

[0010] According to the target pointer, a storage address of the target key value is determined from the key value table.

[0011] The method, by inputting the target key value into the plurality of linear shift registers, determining the first hash result according to the first M1 output sequences, determining the second hash result according to the second M2 output sequences, and determining the position of the hash table corresponding to the target key value by using the first hash result and the second hash result, i.e., determining the position of the hash table corresponding to the target key value by using the results output by the plurality of linear shift registers, reduces the possibility of hash collision.

[0012] Optionally, the initial value of the linear shift register used each time is a Walsh orthogonal code group other than the first group of Walsh orthogonal codes, and the different Walsh orthogonal code groups are orthogonal to each other.

[0013] The method, by setting the initial values of the different output sequences as the Walsh orthogonal code groups orthogonal to each other, uses the orthogonality to reduce the correlation between the plurality of output results.

[0014] Optionally, determining the position of the target hash result corresponding to the target key value in the hash table according to the first hash result and the second hash result comprises:

[0015] determining a first direction index of the target hash result corresponding to the target key value in the hash table according to the first hash result, and determining a second direction index of the target hash result corresponding to the target key value in the hash table according to the second hash result;

[0016] determining a first position of the target hash result in a first direction of the hash table according to the first direction index, and determining the position of the target hash result in the hash table according to the second direction index and the first position;

[0017] If the first direction index is a row direction index, the second direction index is a column direction index; if the first direction index is a column direction index, the second direction index is a row direction index.

[0018] The method, according to the first direction index and the second direction index, can accurately determine the specific position of the target hash result in the hash table.

[0019] Optionally, determining the first hash result corresponding to the target key value according to the first M1 output sequences comprises: determining one first hash result corresponding to the target key value according to the first M1 output sequences; or determining a plurality of first hash results corresponding to the target key value and the first direction of the hash table according to the first M1 output sequences, wherein if the first direction index is a row direction index, M1 is the number of rows of the hash table, and if the first direction index is a column direction index, M1 is the number of columns of the hash table.

[0020] The method determines one or more first hash results corresponding to the target key value according to the first M1 output sequences, and reduces the possibility of hash collision through multiple linear shift register calculations.

[0021] Optionally, when the target key value and the hash table are determined according to the first M1 output sequences, the first direction index of the target hash result corresponding to the target key value in the hash table is determined according to the first hash result, comprising:

[0022] If the first direction index is a row direction index, it is determined whether the row number of any row in the hash table and the first hash result corresponding to any row are the same, and the row number that is the same as the first hash result is determined as the row direction index of the target hash result in the hash table, wherein the first hash result corresponding to any row is determined according to the output sequence corresponding to any row in the first M1 output sequences.

[0023] If the first direction index is a column direction index, it is determined whether the column number of any column in the hash table and the first hash result corresponding to any column are the same, and the column number that is the same as the first hash result is determined as the column direction index of the target hash result in the hash table, wherein the first hash result corresponding to any column is determined according to the output sequence corresponding to any column in the first M1 output sequences.

[0024] The method compares each first hash result in any direction with the corresponding result in the hash table, determines the corresponding first direction index according to the same result when the same result is determined, and can accurately find the position corresponding to the target hash result in the hash table.

[0025] Optionally, the second hash result corresponding to the target key value is determined according to the last M2 output sequences, comprising: determining one second hash result corresponding to the target key value according to the last M2 output sequences; or determining multiple second hash results corresponding to the target key value and the hash table in the second direction according to the last M2 output sequences, wherein if the second direction index is a row direction index, M2 is the number of rows of the hash table, and if the second direction index is a column direction index, M2 is the number of columns of the hash table.

[0026] Optionally, when the target key value and the hash table are determined according to the last M2 output sequences, the second direction index of the target hash result corresponding to the target key value in the hash table is determined according to the second hash result, comprising:

[0027] If the second direction index is a row direction index, it is determined whether the result of any row in the hash table is same as a second hash result corresponding to the any row, and a row direction index of a target hash result corresponding to the target key in the hash table is determined according to the result same as the second hash result, wherein the second hash result corresponding to the any row is determined according to an output sequence corresponding to the any row in the obtained last M2 output sequences;

[0028] If the second direction index is a column direction index, it is determined whether the result of any column in the hash table is same as a second hash result corresponding to the any column, and a column direction index of a target hash result corresponding to the target key in the hash table is determined according to the result same as the second hash result, wherein the second hash result corresponding to the any column is determined according to an output sequence corresponding to the any column in the obtained last M2 output sequences.

[0029] In a second aspect of the embodiments of the present application, a data storage address query device is provided, comprising:

[0030] An output sequence determination module is configured to input a target key value corresponding to an instruction of querying a storage address into a plurality of linear shift registers, and obtain corresponding output sequences, wherein an initial value of the output sequence corresponding to each used linear shift register is different, and a coefficient of each linear shift register is determined according to a primitive polynomial of an m sequence;

[0031] A hash result determination module is configured to determine a first hash result corresponding to the target key according to the obtained first M1 output sequences, and determine a second hash result corresponding to the target key according to the obtained last M2 output sequences, wherein a sum of M1 and M2 is a number of the obtained output sequences;

[0032] A target pointer acquisition module is configured to determine a position of a target hash result corresponding to the target key in a hash table according to the first hash result and the second hash result, and acquire a corresponding target pointer from the position;

[0033] A storage address determination module is configured to determine a storage address of the target key value from a key value table according to the target pointer.

[0034] In a third aspect of the embodiments of the present application, a data storage address query device is provided, comprising:

[0035] A processor; a memory for storing processor executable instructions;

[0036] The processor is configured to execute the instructions to implement the method of any one of the above data storage address query methods.

[0037] In a fourth aspect of the embodiments of the present application, a computer-readable nonvolatile storage medium is provided, including computer-readable instructions, which, when read and executed by a computer, cause the computer to perform the method of any one of the above data storage address query methods.

[0038] In a fifth aspect of the embodiments of the present application, a computer program product is provided, including a computer program stored in a computer-readable nonvolatile storage medium; when a processor of an electronic device reads the computer program from the computer-readable nonvolatile storage medium, the processor executes the computer program, so that the electronic device performs the method of any one of the above data storage address query methods. BRIEF DESCRIPTION OF DRAWINGS

[0039] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.

[0040] Figure 1 A schematic diagram of an application scenario of the data storage address query method provided by the embodiments of the present application;

[0041] Figure 2 A flowchart of the data storage address query method provided by the embodiments of the present application;

[0042] Figure 3 A structural schematic diagram of a linear shift register provided by the embodiments of the present application;

[0043] Figure 4 A schematic diagram of a data storage address query process provided by the embodiments of the present application;

[0044] Figure 5 A schematic diagram of a data storage address query device provided by the embodiments of the present application;

[0045] Figure 6 A schematic diagram of a data storage address query device provided by the embodiments of the present application. DETAILED DESCRIPTION

[0046] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below with reference to the drawings.

[0047] The application scenarios described in the embodiments of the present application are used to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided by the embodiments of the present application. It can be known by a person of ordinary skill in the art that, with the appearance of new application scenarios, the technical solutions provided by the embodiments of the present application are also applicable to similar technical problems. It should be noted that the terms "first", "second" and the like in the description, claims and accompanying drawings of the present application are used to distinguish similar objects, and do not necessarily indicate a specific order or sequence. The data used in this way can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. The implementations described in the following exemplary embodiments do not represent all the implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art without creative labor fall within the scope of protection of the present application.

[0048] Currently, data reverse lookup address function is often used in data processing: that is, given a key value KEY, and then the address of the stored key value is expected. For example, hash calculation is often used in CACHE processing and in network processing to configure a given forwarding table to convert the given KEY into the address to be looked up. However, since the length of the general KEY is often greater than the length of the storage address to be looked up, the hash operation often brings conflicts. Currently, there are basically three methods to solve the conflicts: (1) open addressing method; (2) rehash method; (3) chain address method.

[0049] Among them, the design of hash in open address method has a great influence on conflict, and multiple conflicts may occur when inserting, and the deleted element is one of multiple conflict elements, which needs to process the subsequent elements, so the implementation is relatively complex, and a lot of space will be wasted when the node scale is large, and the accumulation problem is easy to occur, which is not suitable for large-scale data storage. The rehash method increases the calculation time due to the calculation of twice, and the time delay will increase, but the calculation is relatively simple. Although the chain address method is simple to handle conflicts and has no accumulation phenomenon, and the average search length is short, it is not often used in the above scenarios because of the relatively complex calculation.

[0050] Figure 1 The application scenarios provided by the embodiments of the present application are shown in the schematic diagram, and the data storage address query method provided by the embodiments of the present application is mainly applied to Figure 1In the two scenarios, CACHE processing and data communication processing, hash is often used to handle the hit problem. Reducing hash collisions can produce the following beneficial effects.

[0051] 1. To improve CACHE hit rate.

[0052] As shown in Figure 1 In an FPGA (Field Programmable Gate Array)-based smart network card, internal block RAM (Random Access Memory) is often used as CACHE for external DDR RAM (Double Data Rate) because the internal RAM of the FPGA has fast access speed and can be pipelined. If the system can hit the required result in CACHE, the system performance will be greatly improved.

[0053] 2. To improve lookup table hit rate in a data center.

[0054] As shown in Figure 1 When the internal RAM of the FPGA is used as a lookup table without external DDR, only a hit or miss conclusion is given. This lookup table is generally not too large, and a typical application is the CACHE table of ARP. The system has high requirements for hash collisions. If no hash collision occurs, the lookup table hit rate in the data center will be greatly improved.

[0055] To balance the latency and computational complexity, the embodiment of the application designs a data storage address query method based on the above problems and m sequences and Walsh orthogonal codes. The method uses the good hash function of m sequences to perform hash calculation to obtain good addressing, uses Walsh orthogonal codes as initial values for generating m sequences to obtain better hash effects, and effectively reduces the hash collision problem.

[0056] Figure 2 A flowchart of a data storage address query method provided by the embodiment of the application is shown in Figure 2 The application provides a data storage address query method, which includes the following steps:

[0057] Step 201: In response to an instruction for querying a storage address, input a target key value corresponding to the instruction into a plurality of linear shift registers to obtain corresponding output sequences, respectively, wherein the initial value of the linear shift register used each time is different, and the coefficients of each linear shift register are determined according to a primitive polynomial of an m sequence.

[0058] Step 202: Determine the first hash result corresponding to the target key value based on the first M1 output sequences obtained, and determine the second hash result corresponding to the target key value based on the last M2 output sequences obtained, wherein the sum of M1 and M2 is the number of the obtained output sequences;

[0059] Step 203: Determine the position of the target hash result corresponding to the target key value in the hash table based on the first hash result and the second hash result, and obtain the corresponding target pointer from the position;

[0060] Step 204: Determine the storage address of the target key value from the key-value table based on the target pointer.

[0061] The above method inputs the target key value into multiple linear shift registers, determines the first hash result based on the first M1 output sequences, determines the second hash result based on the last M2 output sequences, and uses the first and second hash results to determine the position of the target key value in the hash table. In other words, it uses the results of multiple outputs from the linear shift registers to determine the position of the target key value in the hash table, which greatly reduces the possibility of hash collisions.

[0062] The result of the linear shift register in step 201 above is as follows: Figure 3 As shown, the primitive polynomial f(z) of the linear shift register sequence (m-sequence) is as follows:

[0063] f(z) = g0 + g1z -1 +g2z -2 +....+g n z -n

[0064] Among them, the above g n The value of z represents the nth coefficient of the primitive polynomial of the m-sequence, and its value is determined by the value of n. The above z is the delay factor, and the above n is the number of registers in the linear shift register structure.

[0065] Because the m-sequence has good autocorrelation properties and its cross-correlation is almost zero, the spectrum of the m-sequence is relatively flat. That is to say, Figure 3 The output sequence generated by the structure shown has good hashing performance. Therefore, in this embodiment, the above-mentioned m-sequence is used to determine the hash result of the target key value. The process of obtaining the output sequence (i.e., m-sequence) of the linear shift register in this embodiment is as follows: The target key value is input into the above-mentioned linear shift register. The linear shift register performs shift calculation according to the input target key value. After the calculation is completed, the values ​​stored in multiple registers are obtained and arranged in order according to the arrangement of the registers to form the above-mentioned output sequence.

[0066] It should be noted that although the embodiment of the present application does not limit the specific value of the number n of registers in the linear shift register structure, in order to meet the requirements, the linear shift register cannot be too small, and at least the 2 power of the bit width needs to be greater than the size of the hash table. Since the storage size of the hash table is limited, it is usually less than 2 to the power of 64, and therefore a 64-bit linear shift register can basically meet the requirements. In a specific implementation, it can be set according to requirements, and the number of registers used each time when the target key value is input into the linear shift register can be the same or different.

[0067] Similarly, the embodiment of the present application does not limit the number of times the target key value is input into the linear shift register in step 201, and in a specific implementation, it can be set according to requirements.

[0068] Due to the value of the output sequence of the linear shift register, in addition to the input target key value, it is also affected by the initial value of the output sequence. In order to reduce the generation of hash conflicts as much as possible, the initial value corresponding to the linear shift register used each time is different in the embodiment of the present application.

[0069] In order to further reduce the generation of hash conflicts, the initial value (i.e. the initial phase of the register) of the linear shift register used each time in the embodiment of the present application is a Walsh orthogonal code group, and different Walsh orthogonal code groups are orthogonal to each other. The orthogonality of the Walsh orthogonal code group ensures a small correlation between the output sequences each time.

[0070] Wherein, when determining the Walsh orthogonal code group used for the initial phase of the register, Walsh-Hadamard transform can be used to obtain H 2N The Walsh orthogonal code matrix is shown in the following table:

[0071]

[0072] Wherein, H N is an N-order matrix, is the negation of H N , H1=0, and 2N is the number of registers in the linear shift register.

[0073] Since the first column in the above matrix is 0, when determining the initial value corresponding to the linear shift register used each time, it can be randomly selected from the second column to the 2N column, and it only needs to ensure that the initial value used each time is not the Walsh-Hadamard value of the same column. A possible way is to use the Walsh-Hadamard value in the second column as the initial phase of the register when it is used for the first time, and then use the Walsh-Hadamard value in the third column as the initial phase of the register when it is used for the second time, and so on.

[0074] In the embodiments of the present application, the hash table includes multiple rows and multiple columns, i.e., the storage location of the target hash result in the hash table is a certain row and a certain column. By dividing the hash table in the form of rows and columns, the hash table is increased, and the structure is easy to implement in hardware. The hash result corresponding to each key in the hash table includes at least three parts of valid bits, a signature value (signature) and a pointer, wherein the signature value is the second hash result determined in the embodiments of the present application. Therefore, in the step 203, when the location of the target hash result corresponding to the target key value in the hash table is determined according to the first hash result and the second hash result, the first hash result and the second hash result are respectively used to determine the direction index of the target hash result in different directions of the hash table. Specifically:

[0075] The first direction index of the target hash result corresponding to the target key value in the hash table is determined according to the first hash result, and the second direction index of the target hash result corresponding to the target key value in the hash table is determined according to the second hash result. The first position of the target hash result in the first direction of the hash table is determined according to the first direction index, and the position of the target hash result in the hash table is determined according to the second direction index and the first position. If the first direction index is a row direction index, the second direction index is a column direction index. If the first direction index is a column direction index, the second direction index is a row direction index.

[0076] In some embodiments, the row direction index is the row number corresponding to the target hash result in the hash table, and the column direction index is the column number corresponding to the target hash result in the hash table.

[0077] In a specific implementation, when the first direction index is a row direction index and the second direction index is a column direction index, the row number of the target hash result in the hash table can be determined according to the first direction index, and the position of the target hash result in the hash table is further determined according to the second direction index in the row. When the first direction index is a column direction index, the process is similar.

[0078] In the embodiments of the present application, the step 202 of determining the first hash result corresponding to the target key value according to the obtained first M1 output sequences includes:

[0079] The first hash result corresponding to the target key value is determined according to the obtained first M1 output sequences.

[0080] In some embodiments, all or part of the obtained first M1 output sequences can be combined into a first hash result according to a preset order.

[0081] Alternatively, a plurality of first hash results corresponding to the first direction of the hash table are determined according to the obtained first M1 output sequences respectively, wherein if the first direction index is a row direction index, M1 is the number of rows of the hash table, and if the first direction index is a column direction index, M1 is the number of columns of the hash table.

[0082] In some embodiments, different output sequences among the obtained first M1 output sequences can be used as the first hash results corresponding to the first direction of the hash table, i.e., the first hash results corresponding to each row (or column) of the hash table, wherein each output sequence among the first M1 output sequences corresponds to a row (or column), and the initial values of the output sequences corresponding to each row (or column) are different, so that the possibility of hash collision can be further reduced.

[0083] When the plurality of first hash results corresponding to the first direction of the hash table are determined according to the obtained first M1 output sequences respectively, the first direction index of the target hash result corresponding to the target key value in the hash table is determined according to the first hash result, including the following two cases:

[0084] Case one, if the first direction index is a row direction index, it is determined whether the row number of any row in the hash table is the same as the first hash result corresponding to the row, and the row number that is the same as the first hash result is determined as the row direction index of the target hash result in the hash table, wherein the first hash result corresponding to any row is determined according to the output sequence corresponding to the row among the obtained first M1 output sequences;

[0085] Case two, if the first direction index is a column direction index, it is determined whether the column number of any column in the hash table is the same as the first hash result corresponding to the column, and the column number that is the same as the first hash result is determined as the column direction index of the target hash result in the hash table, wherein the first hash result corresponding to any column is determined according to the output sequence corresponding to the column among the obtained first M1 output sequences.

[0086] The above determination of the second hash result corresponding to the target key value according to the obtained last M2 output sequences includes:

[0087] One second hash result corresponding to the target key value is determined according to the obtained last M2 output sequences;

[0088] In some embodiments, all or part of each output sequence among the obtained last M2 output sequences can be combined into one second hash result according to a preset order.

[0089] Alternatively, a plurality of second hash results corresponding to the second direction of the hash table are determined according to the obtained last M2 output sequences respectively, wherein if the second direction index is a row direction index, M2 is the number of rows of the hash table, and if the second direction index is a column direction index, M2 is the number of columns of the hash table.

[0090] In some embodiments, the obtained last M2 output sequences can be taken as the second hash results corresponding to the second direction of the hash table, such as the second hash results corresponding to each column (row) of the hash table, that is, each output sequence corresponds to a column (row), and the initial value corresponding to each column (row) is different, so that the possibility of hash collision can be further reduced.

[0091] When the target key value and the plurality of second hash results corresponding to the second direction of the hash table are determined according to the obtained last M2 output sequences respectively, the second direction index of the target hash result corresponding to the target key value in the hash table is determined according to the second hash result, including the following two cases:

[0092] Case one, if the second direction index is the row direction index, it is determined whether the result of any row in the hash table is the same as the second hash result corresponding to any row, and the row direction index of the target hash result corresponding to the target key value in the hash table is determined according to the result which is the same as the second hash result, wherein the second hash result corresponding to any row is determined according to the output sequence corresponding to any row in the obtained last M2 output sequences.

[0093] Case two, if the second direction index is the column direction index, it is determined whether the result of any column in the hash table is the same as the second hash result corresponding to any column, and the column direction index of the target hash result corresponding to the target key value in the hash table is determined according to the result which is the same as the second hash result, wherein the second hash result corresponding to any column is determined according to the output sequence corresponding to any column in the obtained last M2 output sequences.

[0094] Wherein, the result of any row / column in the hash table can be the signature value corresponding to the target key value in the hash table.

[0095] Based on the above two first hash result determination methods and the second hash result determination method, the specific method for determining the first hash result corresponding to the target key value according to the obtained first M1 output sequences and the second hash result corresponding to the target key value according to the obtained last M2 output sequences in the embodiments of the present application can include the following four methods:

[0096] Method one, one first hash result corresponding to the target key value is determined according to the obtained first M1 output sequences, and one second hash result corresponding to the target key value is determined according to the obtained last M2 output sequences.

[0097] Method two, a plurality of first hash results corresponding to the target key value and the first direction of the hash table are determined according to the obtained first M1 output sequences respectively, and one second hash result corresponding to the target key value is determined according to the obtained last M2 output sequences.

[0098] Wherein, if the first direction index is a row direction index, M1 is the number of rows of the hash table, and if the first direction index is a column direction index, M1 is the number of columns of the hash table.

[0099] Method three, determining one first hash result corresponding to the target key value according to the obtained first M1 output sequences; and determining a plurality of second hash results corresponding to the target key value and the hash table second direction respectively according to the obtained last M2 output sequences.

[0100] Wherein, if the second direction index is a row direction index, M2 is the number of rows of the hash table, and if the second direction index is a column direction index, M2 is the number of columns of the hash table.

[0101] Method four, determining a plurality of first hash results corresponding to the target key value and the hash table first direction respectively according to the obtained first M1 output sequences; and determining a plurality of second hash results corresponding to the target key value and the hash table second direction respectively according to the obtained last M2 output sequences.

[0102] Wherein, if the first direction index is a row direction index, M1 is the number of rows of the hash table, and M2 is the number of columns of the hash table; and if the first direction index is a column direction index, M1 is the number of columns of the hash table, and M2 is the number of rows of the hash table.

[0103] It should be noted that, when determining the first hash result and the second hash result corresponding to the target key value, which method is used is determined according to the storage method of the target key value, that is, which method of the above four methods is used to determine the storage of the target key value according to which method, for example, when the target key value is stored by using the determination method of the first hash result and the second hash result corresponding to the above method one, when the storage address of the target key value is queried, the method of determining the first hash result and the second hash result also uses the above method one.

[0104] As shown in FIG. 1, the embodiment of the present application determines the initial value of each linear shift register used each time according to Walsh orthogonal codes. Figure 4 Figure 4 The above data storage address query method is introduced in detail by using a specific example, wherein it is assumed that the size of the hash table is N rows and K columns, the first direction index is a row direction index, M1 is 1, and M2 is K.

[0105] Firstly, the embodiment of the present application determines the initial value of each linear shift register used each time according to Walsh orthogonal codes, specifically, the initial value of the linear shift register used for the first time (the first linear shift register) is determined according to the second column, the initial value of the linear shift register used for the second time (the second linear shift register) is determined according to the third column, and the initial value of the linear shift register used for the K+1th time (the second linear shift register) is determined using the K+2th column. ​

[0106] Then, the target key value is input into the first linear shift register to obtain a corresponding output sequence, the first X bits of the output sequence are determined as the first hash result, and the row number (row direction index) of the target hash result in the hash table is determined according to the first hash result, that is, the step described in hash1 in the figure.

[0107] After the row number corresponding to the target hash result is determined, the second hash result (that is, the signature value) corresponding to each column in the row is read out, and the target key value is input into the second linear shift register K times to obtain K output sequences, the first output sequence in the K output sequences is determined as a second hash result (for ease of description, it is named as second hash result 1), the second hash result 1 is compared with the signature value of the first column read out, if they are the same, the first column is determined as the column corresponding to the target hash result, if they are different, the second output sequence in the K output sequences is determined as second hash result 2, the second hash result 2 is compared with the signature value of the second column read out, and whether the column is the column corresponding to the target hash result is determined according to the result, and the process is repeated until the column corresponding to the target hash result is determined (that is, the step described in hash2 in the figure).

[0108] In the formula, the first X bits of the hash result corresponding to each key value are determined as the first hash result, and the last L bits are determined as the column number. Since the value of K is usually in the form of 2 power, L can be calculated by log2K. For example, when K = 8, L = 3. In this way, the data in a row can be read out continuously by using hardware DMA, and the data throughput rate is improved.

[0109] Finally, after the position corresponding to the target hash result in the hash table is determined according to the above row index and column index, the target pointer corresponding to the position is obtained, and the storage address of the target key value in the key value table is determined according to the target pointer.

[0110] After the storage address of the target key value is determined, the target key value can also be read from the storage address and compared with the input target key value to determine whether they match, so as to determine whether the storage address of the query is correct.

[0111] Based on the same disclosure concept, the embodiment of the present application also provides a data storage address query device. Since the device is the device in the method of the embodiment of the present application, and the principle of solving the problem of the device is similar to that of the method, the implementation of the device can be referred to the implementation of the method, and the repeated parts will not be described here.

[0112] Figure 5 The structure diagram of a data storage address query device provided by the embodiment of the present application is shown in FIG. 1. Figure 5 The embodiment of the present application provides a data storage address query device, which comprises:

[0113] The output sequence determination module 501 is configured to input the target key value corresponding to the instruction of querying the storage address into a plurality of linear shift registers in response to the instruction of querying the storage address, and obtain a corresponding output sequence respectively, wherein the initial value of the linear shift register used each time is different, and the coefficient of each linear shift register is determined according to a primitive polynomial of an m-sequence.

[0114] The hash result determination module 502 is configured to determine a first hash result corresponding to the target key value according to the first M1 output sequences, and determine a second hash result corresponding to the target key value according to the last M2 output sequences, wherein the sum of M1 and M2 is the number of the obtained output sequences.

[0115] The target pointer acquisition module 503 is configured to determine the position of the target hash result corresponding to the target key value in the hash table according to the first hash result and the second hash result, and acquire the corresponding target pointer from the position.

[0116] The storage address determination module 504 is configured to determine the storage address of the target key value in the key-value table according to the target pointer.

[0117] Optionally, the initial value of the linear shift register used each time is a Walsh orthogonal code group other than the first group of Walsh orthogonal codes, and the different Walsh orthogonal code groups are orthogonal to each other.

[0118] Optionally, the target pointer acquisition module 503 is configured to determine the position of the target hash result corresponding to the target key value in the hash table according to the first hash result and the second hash result, and the method comprises the following steps.

[0119] determining a first direction index of the target hash result corresponding to the target key value in the hash table according to the first hash result, and determining a second direction index of the target hash result corresponding to the target key value in the hash table according to the second hash result; determining a first position of the target hash result in the hash table in a first direction according to the first direction index, and determining the position of the target hash result in the hash table according to the second direction index and the first position; wherein if the first direction index is a row direction index, the second direction index is a column direction index; if the first direction index is a column direction index, the second direction index is a row direction index.

[0120] Optionally, the hash result determination module 502 is configured to determine the first hash result corresponding to the target key value according to the obtained first M1 output sequences, including: determining one first hash result corresponding to the target key value according to the obtained first M1 output sequences; or determining a plurality of first hash results corresponding to the target key value and the first direction of the hash table according to the obtained first M1 output sequences respectively, wherein if the first direction index is a row direction index, M1 is the number of rows of the hash table, and if the first direction index is a column direction index, M1 is the number of columns of the hash table.

[0121] Optionally, when the target pointer acquisition module 503 is configured to determine a plurality of first hash results corresponding to the target key value and the first direction of the hash table according to the obtained first M1 output sequences respectively, the target pointer acquisition module 503 is configured to determine the first direction index of the target hash result corresponding to the target key value in the hash table according to the first hash result, including:

[0122] If the first direction index is a row direction index, it is determined whether the row number of any row in the hash table and the first hash result corresponding to any row are the same, and the row number that is the same as the first hash result is determined as the row direction index of the target hash result in the hash table, wherein the first hash result corresponding to any row is determined according to the output sequence corresponding to any row in the obtained first M1 output sequences;

[0123] If the first direction index is a column direction index, it is determined whether the column number of any column in the hash table and the first hash result corresponding to any column are the same, and the column number that is the same as the first hash result is determined as the column direction index of the target hash result in the hash table, wherein the first hash result corresponding to any column is determined according to the output sequence corresponding to any column in the obtained first M1 output sequences.

[0124] Optionally, the hash result determination module 502 is configured to determine the second hash result corresponding to the target key value according to the obtained last M2 output sequences, including: determining one second hash result corresponding to the target key value according to the obtained last M2 output sequences; or determining a plurality of second hash results corresponding to the target key value and the second direction of the hash table according to the obtained last M2 output sequences respectively, wherein if the second direction index is a row direction index, M2 is the number of rows of the hash table, and if the second direction index is a column direction index, M2 is the number of columns of the hash table.

[0125] Optionally, when the target pointer acquisition module 503 is configured to determine a plurality of second hash results corresponding to the target key value and the second direction of the hash table according to the obtained last M2 output sequences respectively, the target pointer acquisition module 503 is configured to determine the second direction index of the target hash result corresponding to the target key value in the hash table according to the second hash result, including:

[0126] If the second direction index is a row direction index, it is determined whether the result of any row in the hash table is same as a second hash result corresponding to the any row, and a row direction index of a target hash result corresponding to the target key in the hash table is determined according to the result same as the second hash result, wherein the second hash result corresponding to the any row is determined according to the output sequence corresponding to the any row in the obtained last M2 output sequences.

[0127] If the second direction index is a column direction index, it is determined whether the result of any column in the hash table is same as a second hash result corresponding to the any column, and a column direction index of a target hash result corresponding to the target key in the hash table is determined according to the result same as the second hash result, wherein the second hash result corresponding to the any column is determined according to the output sequence corresponding to the any column in the obtained last M2 output sequences.

[0128] Based on the same disclosure idea, the present application further provides a data storage address query device. Since the device is the device in the method of the present application, and the principle of the device solving the problem is similar to that of the method, the implementation of the device can be referred to the implementation of the method, and the repeated parts will not be described here.

[0129] Those skilled in the art can understand that each aspect of the present application can be implemented as a system, a method or a program product. Therefore, each aspect of the present application can be specifically implemented as follows: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software aspects, which can be collectively referred to as "circuitry", "module" or "system".

[0130] In some possible implementation, the device according to the present application can include at least one processor and at least one memory. The memory stores program codes, and when the program codes are executed by the processor, the processor executes the steps of the data storage address query method according to various exemplary embodiments of the present application described above in the specification.

[0131] The device 600 according to this embodiment of the present application will be described below with reference to Figure 6 The device 600 according to this embodiment of the present application will be described below with reference to Figure 6 The device 600 shown is only an example, and should not bring any limitation to the functions and use range of the embodiments of the present application.

[0132] As Figure 6As shown, the device 600 is in the form of a general-purpose device. The components of the device 600 can include, but are not limited to, the at least one processor 601 described above, the at least one memory 602 described above, a bus 603 that connects different system components, including the memory 602 and the processor 601, wherein the memory stores program codes, when the program codes are executed by the processor, the processor performs the following steps:

[0133] In response to the instruction of querying the storage address, input the target key value corresponding to the instruction into a plurality of linear shift registers to obtain a corresponding output sequence respectively, wherein the initial value corresponding to each time used linear shift register is different, and the coefficient of each linear shift register is determined according to the primitive polynomial of the m sequence;

[0134] Determine the first hash result corresponding to the target key value according to the obtained first M1 output sequences, and determine the second hash result corresponding to the target key value according to the obtained last M2 output sequences, wherein the sum of M1 and M2 is the number of obtained output sequences;

[0135] According to the first hash result and the second hash result, determine the position of the target hash result corresponding to the target key value in the hash table, and obtain the corresponding target pointer from the position;

[0136] According to the target pointer, determine the storage address of the target key value in the key value table.

[0137] The bus 603 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, a processor or local bus using any of a variety of bus architectures. The memory 602 can include read-only memory (ROM) 6023 in the form of a volatile memory, such as a random access memory (RAM) 6021 and / or a cache memory 6022, and can further include a read-only memory (ROM) 6023.

[0138] The memory 602 can also include program / utility 6025 having a set of (at least one) program modules 6024, including but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which or a combination of which can include implementation of a network environment.

[0139] Device 600 can also communicate with one or more external devices 604 (e.g., keyboard, pointing device, etc.), and with one or more devices that enable a user to interact with device 600, and / or with any device that enables device 600 to communicate with one or more other devices (e.g., router, modem, etc.). This communication can be performed via input / output (I / O) interface 605. Furthermore, device 600 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 606. As shown, network adapter 606 communicates with other modules used with device 600 via bus 603. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with device 600, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0140] Optionally, the initial value of the linear shift register used each time is a Walsh orthogonal code group other than the first group of Walsh orthogonal code groups, and the different Walsh orthogonal code groups are mutually orthogonal.

[0141] Optionally, the processor described above is used to determine the position of the target hash result corresponding to the target key value in the hash table based on the first hash result and the second hash result, including:

[0142] The first direction index of the target hash result corresponding to the target key value in the hash table is determined based on the first hash result; and the second direction index of the target hash result corresponding to the target key value in the hash table is determined based on the second hash result; the first position of the target hash result in the first direction of the hash table is determined based on the first direction index, and the position of the target hash result in the hash table is determined based on the second direction index and the first position; wherein, if the first direction index is a row direction index, then the second direction index is a column direction index; if the first direction index is a column direction index, then the second direction index is a row direction index.

[0143] Optionally, the processor is used to determine the first hash result corresponding to the target key value based on the first M1 output sequences, including: determining a first hash result corresponding to the target key value based on the first M1 output sequences; or determining multiple first hash results corresponding to the target key value and the first direction of the hash table based on the first M1 output sequences respectively, wherein if the first direction index is a row direction index, then M1 is the number of rows in the hash table, and if the first direction index is a column direction index, then M1 is the number of columns in the hash table.

[0144] Optionally, the processor is configured to determine, according to the first hash results, a first direction index of the target hash result of the target key value in the hash table when the target key value and a plurality of first hash results corresponding to the first direction of the hash table are determined according to the obtained first M1 output sequences respectively, comprising:

[0145] If the first direction index is a row direction index, it is determined whether the row number of any row in the hash table and the first hash result corresponding to any row are the same, and the row number that is the same as the first hash result is determined as the row direction index of the target hash result in the hash table, wherein the first hash result corresponding to any row is determined according to the output sequence corresponding to any row in the obtained first M1 output sequences;

[0146] If the first direction index is a column direction index, it is determined whether the column number of any column in the hash table and the first hash result corresponding to any column are the same, and the column number that is the same as the first hash result is determined as the column direction index of the target hash result in the hash table, wherein the first hash result corresponding to any column is determined according to the output sequence corresponding to any column in the obtained first M1 output sequences.

[0147] Optionally, the processor is configured to determine the second hash result corresponding to the target key value according to the obtained last M2 output sequences, comprising: determining one second hash result corresponding to the target key value according to the obtained last M2 output sequences; or determining a plurality of second hash results corresponding to the target key value and the second direction of the hash table respectively, wherein if the second direction index is a row direction index, M2 is the number of rows of the hash table, and if the second direction index is a column direction index, M2 is the number of columns of the hash table.

[0148] Optionally, the processor is configured to determine, according to the second hash results, a second direction index of the target hash result of the target key value in the hash table when the target key value and a plurality of second hash results corresponding to the second direction of the hash table are determined according to the obtained last M2 output sequences respectively, comprising:

[0149] If the second direction index is a row direction index, it is determined whether the result of any row in the hash table and the second hash result corresponding to any row are the same, and the row direction index of the target hash result of the target key value in the hash table is determined according to the result that is the same as the second hash result, wherein the second hash result corresponding to any row is determined according to the output sequence corresponding to any row in the obtained last M2 output sequences;

[0150] If the second direction index is the column direction index, it is determined whether the result of any column in the hash table is same as the second hash result corresponding to any column, and the column direction index of the target hash result corresponding to the target key in the hash table is determined according to the result same as the second hash result, wherein the second hash result corresponding to any column is determined according to the output sequence corresponding to any column in the obtained last M2 output sequences.

[0151] In some possible implementation manners, each of the aspects of the data storage address query method provided in the present application can also be implemented in the form of a program product, which includes program codes for causing a computer device to execute the steps of the data storage address query method according to various exemplary embodiments of the present application described above in the specification when the program product is run on the computer device.

[0152] The program product can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium may, for example, be but is not limited to an electronic, magnetic, optical, or semiconductor system, device, or apparatus, or any combination of the above. The program code for executing the operations of the present application can be written in any combination of one or more programming languages. The program code can be executed completely or partially on the user device, as an independent software package, partially on the user device and partially on a remote device, or completely on a remote device or server.

[0153] It should be noted that although several units or sub-units of the apparatus are mentioned in the foregoing detailed description, such division is merely exemplary and is not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more units described above can be embodied in one unit. Conversely, the features and functions of one unit described above can be further divided into units embodied by multiple units.

[0154] In addition, although the operations of the method of the present application are described in a specific order in the accompanying drawings, this does not require or imply that the operations must be performed in that specific order, or that all of the shown operations must be performed to achieve the desired result. Additionally or alternatively, certain steps can be omitted, a plurality of steps can be combined into one step, and / or one step can be divided into a plurality of steps.

[0155] Those skilled in the art will appreciate that embodiments of the present application can be readily used as software, hardware, or a combination of software and hardware. In one embodiment, the present application can be implemented in software and can be stored on a computer readable medium, which can include random access memory (RAM), read only memory (ROM), magnetic disk or optical disk, or the like. The software implementation can comprise one or more computer program components embodied on one or more computer readable medium(s).

[0156] The present application is described in reference to the flowchart illustrations and block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the application. It will be understood that each block of the flowchart illustrations and block diagrams, and combinations of blocks in the flowchart illustrations and 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 processing device, 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 means for implementing the functions specified in the flowchart illustrations and / or block diagrams. Figure 1 one or more functions specified in the flowchart illustrations and / or block diagrams. Figure 1 one or more functions specified in the flowchart illustrations and / or block diagrams.

[0157] These computer program instructions can also be stored in a computer readable medium that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer readable medium produce an article of manufacture including instructions which implement the functions specified in the flowchart illustrations and / or block diagrams. Figure 1 one or more functions specified in the flowchart illustrations and / or block diagrams. Figure 1 one or more functions specified in the flowchart illustrations and / or block diagrams.

[0158] These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart illustrations and / or block diagrams. Figure 1 one or more functions specified in the flowchart illustrations and / or block diagrams. Figure 1 one or more functions specified in the flowchart illustrations and / or block diagrams.

[0159] Obviously, numerous modifications and variations of the present application are possible in light of the above teachings. It is therefore to be understood that within the scope of the appended claims and their equivalents, the application can be practiced otherwise than as specifically described.

Claims

1. A data storage address inquiry method, characterized by, The method comprises: In response to an instruction for querying a storage address, input a target key value corresponding to the instruction into a plurality of linear shift registers to obtain a corresponding output sequence, wherein an initial value of a linear shift register used each time is different, and a coefficient of each linear shift register is determined according to a primitive polynomial of a longest linear shift register m sequence; Determine a first hash result corresponding to the target key value according to a first M1 output sequence obtained, and determine a second hash result corresponding to the target key value according to a second M2 output sequence obtained, wherein a sum of M1 and M2 is a number of the output sequences obtained; Determine a position of a target hash result corresponding to the target key value in a hash table according to the first hash result and the second hash result, and obtain a corresponding target pointer from the position; Determine a storage address of the target key value from a key value table according to the target pointer.

2. The method of claim 1, wherein, The initial value of the linear shift register used each time is a Walsh orthogonal code group other than a first group of Walsh orthogonal codes, and different Walsh orthogonal code groups are orthogonal to each other.

3. The method of claim 1, wherein, The determination of the position of the target hash result corresponding to the target key value in the hash table according to the first hash result and the second hash result comprises: Determine a first direction index of the target hash result corresponding to the target key value in the hash table according to the first hash result; and Determine a second direction index of the target hash result corresponding to the target key value in the hash table according to the second hash result; Determine a first position of the target hash result in a first direction of the hash table according to the first direction index, and determine the position of the target hash result in the hash table according to the second direction index and the first position; If the first direction index is a row direction index, the second direction index is a column direction index; if the first direction index is a column direction index, the second direction index is a row direction index.

4. The method of claim 3, wherein, The determination of the first hash result corresponding to the target key value according to the first M1 output sequences obtained comprises: Determine one first hash result corresponding to the target key value according to the first M1 output sequences obtained; or Determine a plurality of first hash results corresponding to the target key value and a first direction of the hash table according to the first M1 output sequences respectively, wherein if the first direction index is a row direction index, the M1 is a number of rows of the hash table, and if the first direction index is a column direction index, the M1 is a number of columns of the hash table.

5. The method of claim 4, wherein, The determination of the first direction index of the target hash result corresponding to the target key value in the hash table according to the first hash result when the first M1 output sequences obtained determine a plurality of first hash results corresponding to the target key value and a first direction of the hash table comprises: If the first direction index is a row direction index, determining whether a row number of any row in the hash table is same as a first hash result corresponding to the any row, and determining a row direction index of the target hash result in the hash table as the row number same as the first hash result, wherein the first hash result corresponding to the any row is determined according to an output sequence corresponding to the any row in the obtained first M1 output sequences; If the first direction index is a column direction index, determining whether a column number of any column in the hash table is same as a first hash result corresponding to the any column, and determining a column direction index of the target hash result in the hash table as the column number same as the first hash result, wherein the first hash result corresponding to the any column is determined according to an output sequence corresponding to the any column in the obtained first M1 output sequences.

6. The method according to any one of claims 3 to 5, characterized in that, determining a second hash result corresponding to the target key value according to the obtained last M2 output sequences, comprising: determining one second hash result corresponding to the target key value according to the obtained last M2 output sequences; or determining a plurality of second hash results corresponding to the target key value and a second direction of the hash table according to the obtained last M2 output sequences respectively, wherein if the second direction index is a row direction index, the M2 is a row number of the hash table, and if the second direction index is a column direction index, the M2 is a column number of the hash table.

7. The method of claim 6, wherein, when the obtained last M2 output sequences determine a plurality of second hash results corresponding to the target key value and a second direction of the hash table respectively, determining a second direction index of the target hash result corresponding to the target key value in the hash table according to the second hash result, comprising: if the second direction index is a row direction index, determining whether a result of any row in the hash table is same as a second hash result corresponding to the any row, and determining a row direction index of the target hash result in the hash table according to the result same as the second hash result, wherein the second hash result corresponding to the any row is determined according to an output sequence corresponding to the any row in the obtained last M2 output sequences; if the second direction index is a column direction index, determining whether a result of any column in the hash table is same as a second hash result corresponding to the any column, and determining a column direction index of the target hash result in the hash table according to the result same as the second hash result, wherein the second hash result corresponding to the any column is determined according to an output sequence corresponding to the any column in the obtained last M2 output sequences.

8. A data storage address inquiry apparatus characterized by comprising: The apparatus comprises: an output sequence determination module, configured to input a target key value corresponding to an instruction of querying a storage address into a plurality of linear shift registers in response to the instruction, and obtain corresponding output sequences respectively, wherein initial values of the linear shift registers used each time are different, and coefficients of each linear shift register are determined according to a primitive polynomial of an m-sequence; The hash result determination module is configured to determine a first hash result corresponding to the target key-value according to the obtained first M1 output sequences, and determine a second hash result corresponding to the target key-value according to the obtained last M2 output sequences, wherein the sum of M1 and M2 is the number of the obtained output sequences; The target pointer acquisition module is configured to determine a position of a target hash result corresponding to the target key-value in a hash table according to the first hash result and the second hash result, and acquire a corresponding target pointer from the position. The storage address determination module is configured to determine a storage address of the target key-value in a key-value table according to the target pointer.

9. A data storage address inquiry apparatus, characterized by comprising: The device comprises: a processor; a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement the method of any one of claims 1 to 7.

10. A computer-readable non-transitory storage medium, comprising: computer-readable instructions that, when read and executed by a computer, cause the computer to perform the method of any one of claims 1 to 7.

Citation Information

Patent Citations

  • Method and device for processing table items based on Hash table

    CN102682116A

  • Device and method for accessing Hash table

    CN104809179A