WO2018099107A1 - Hash table management method and device, and computer storage medium - Google Patents

Hash table management method and device, and computer storage medium Download PDF

Info

Publication number
WO2018099107A1
WO2018099107A1 PCT/CN2017/094249 CN2017094249W WO2018099107A1 WO 2018099107 A1 WO2018099107 A1 WO 2018099107A1 CN 2017094249 W CN2017094249 W CN 2017094249W WO 2018099107 A1 WO2018099107 A1 WO 2018099107A1
Authority
WO
WIPO (PCT)
Prior art keywords
hash
linked list
hash table
key value
stored
Prior art date
Application number
PCT/CN2017/094249
Other languages
French (fr)
Chinese (zh)
Inventor
王晓泾
陈西
刘振伟
包闯
闫振林
Original Assignee
深圳市中兴微电子技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳市中兴微电子技术有限公司 filed Critical 深圳市中兴微电子技术有限公司
Publication of WO2018099107A1 publication Critical patent/WO2018099107A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • G06F16/2255Hash tables

Definitions

  • the present invention relates to the field of communications technologies, and in particular, to a method and apparatus for managing a hash table, and a computer storage medium.
  • the network processor is a dedicated instruction processor involved in the field of network applications. It is designed for network packet processing and can make the network system have high performance and high flexibility.
  • the network processor uses a hash table to establish an index relationship of information when performing information search, thereby realizing quick information search.
  • the hash table uses a hash algorithm to establish an index relationship.
  • the hash algorithm is used to calculate the storage address of the hash table item information corresponding to the key value, so that the hash table item information corresponding to the key value can be directly found through the storage address.
  • embodiments of the present invention are expected to provide a method and apparatus for hash table management, and a computer storage medium, which improve the number of hash collisions.
  • the embodiment of the invention provides a method for managing a hash table, including:
  • the linked list is used to store the hash table corresponding to the hash key value of the hash conflict, and the root table is used to store the hash table corresponding to each hash key value and the linked list information item, where the linked list information item is used to indicate the linked list. Whether there is a hash table entry corresponding to each hash key value;
  • the method further includes: performing a hash calculation on the obtained hash key value according to the hash function corresponding to the root table, to obtain a first hash value;
  • the storing the hash table item to be stored into the root table includes:
  • the hash table corresponding to the first hash value exists in the root table, and the hash table entry is read according to the first hash value in the root table, and the obtained hash key value and the root table are read.
  • the hash table corresponding to the first hash value in the root table is updated to the hash table item to be stored; the obtained hash key is obtained. If the value does not match the hash key value in the hash table entry read in the root table, and the storage location of the hash table entry still exists in the root table, insert the to-be-stored in the root table. History entry
  • the hash table entry to be stored is inserted into the root table.
  • the using the linked list to store the hash table corresponding to the hash key value of the hash conflict including:
  • the linked list information item is not included in the read storage data, and the obtained hash key value does not match the hash key value in the hash table entry read in the root table, and the root table does not exist.
  • a linked list is created, and the hash table to be stored is inserted in the created linked list.
  • the method further includes: updating the linked list information item in the root table based on the hash table item inserted in the linked list.
  • the linked list information item is further used to indicate address information of a hash entry existing in the linked list
  • the storing the hash table item to be stored into the linked list includes:
  • the hash table entry is read according to the second hash value in the linked list, and the obtained hash key value and the linked list are read out.
  • the hash table corresponding to the second hash value in the linked list is updated to the hash table to be stored; the hash key value and the read are obtained.
  • the hash table entries to be stored are inserted into the linked list;
  • a hash table entry to be stored is inserted in the linked list.
  • the method includes: updating the linked list information item based on the inserted hash table item.
  • the method further includes:
  • the hash table entry is searched in the root table according to the search key value, and the hash table entry search result is obtained;
  • Hash table entry When the hash table entry search result indicates that the hash table corresponding to the search key value does not exist in the root table, the hash table entry is searched in the linked list according to the search key value, and the linked list is matched with the search key value. Hash table entry.
  • the method further includes: presetting a first storage space and a second storage space, where the capacity of the second storage space is greater than the capacity of the first storage space;
  • the hash table entries in the root table are stored in the first storage space or the second storage space, and the hash table entries in the linked list are stored in the second storage space.
  • the embodiment of the invention further provides a device for managing a hash table, the device comprising: a linked list and a root table, wherein:
  • a linked list configured to store a hash table entry corresponding to a hash key value in which a hash conflict occurs
  • the root table is configured to store a linked list information item and a hash table entry corresponding to each hash key value, where the linked list information item is used to indicate whether a hash table entry corresponding to each hash key value exists in the linked list;
  • the device further includes: an obtaining module and a processing module; wherein
  • Obtaining a module configured to obtain a hash key value and a hash table item to be stored
  • the processing module is configured to: read the stored data in the root table according to the obtained hash key value; and store the hash table item to be stored to the root table when the stored storage data does not include the linked list information item
  • the hash table item to be stored is stored in the linked list when the linked list information item is included in the read storage data.
  • the processing module is further configured to perform hash calculation on the obtained hash key value according to a hash function corresponding to the root table, to obtain a first hash value;
  • the processing module is further configured to: in the root table, a hash table entry corresponding to the first hash value, where the hash table entry is read according to the first hash value, When the obtained hash key value matches the hash key value in the hash table entry read in the root table, the hash table corresponding to the first hash value in the root table is updated to be stored.
  • the processing module is further configured to not include the linked list information item in the read storage data, and the obtained hash key value and the hash key in the hash table item read in the root table If the value does not match, and the storage location of the hash table entry does not exist in the root table, the linked list is created, and the hash table to be stored is inserted in the established linked list.
  • the processing module is further configured to: after inserting the hash table item to be stored in the linked list, update the linked list information item in the root table based on the hash table item inserted in the linked list.
  • the linked list information item is further used to indicate address information of a hash entry existing in the linked list
  • the processing module is further configured to perform a hash calculation on the obtained hash key value according to the hash function corresponding to the linked list, to obtain a second hash value, and obtain the hash in the linked list information item.
  • the address information of the hash table corresponding to the key value is recorded as a third hash value;
  • the processing module is further configured to: when the third hash value and the second hash value are the same, read the hash table entry according to the second hash value in the linked list, and obtain the hash key When the value matches the hash key value in the hash table entry in the linked list, the hash table corresponding to the second hash value in the linked list is updated to the hash table to be stored; When the hash key value does not match the hash key value in the read hash table entry, the hash table entry to be stored is inserted in the linked list; the third hash value and the second hash value are When the hash values are different, the hash table entry to be stored is inserted in the linked list.
  • the processing module is further configured to: after inserting the hash table item to be stored in the linked list, update the linked list information item based on the inserted hash table item.
  • the device further includes: a lookup module
  • the search module is further configured to obtain a lookup key value for performing a hash search; perform a hash table item search in the root table according to the search key value, and obtain a hash table item search result; and search results in the hash table item.
  • the hash table entry corresponding to the search key value exists in the root table
  • the hash table entry corresponding to the search key value in the root table is determined in the hash table entry search result; in the hash table entry If the search result indicates that the hash table corresponding to the search key value does not exist in the root table, the hash table entry is searched in the linked list according to the search key value, and the hash table corresponding to the search key value in the linked list is obtained.
  • the device further includes: a first storage space and a second storage space, where the capacity of the second storage space is greater than the capacity of the first storage space;
  • the storage location of the hash table entry in the root table is the first storage space or the second storage space, and the storage location of the hash table entry in the linked list is the second storage space.
  • Embodiments of the present invention also provide a computer storage medium storing a computer program configured to perform the method of hash table management described above.
  • a method and device for managing hash table according to an embodiment of the present invention uses a linked list to store a hash table entry corresponding to a hash key value in which a hash conflict occurs, and use a root table to store each hash key value corresponding to the hash table.
  • the linked list information item is used to indicate whether there is a hash table entry corresponding to each hash key value in the linked list; obtaining a hash key value and a hash table entry to be stored; Reading the stored data in the root table according to the obtained hash key value; storing the hash table item to be stored in the root table when the stored storage data does not include the linked list information item; When the stored data includes the linked list information item, the hash table item to be stored is stored in the linked list. In this way, the number of hash collisions is increased.
  • FIG. 1 is a flow chart of a first embodiment of a method for managing hash table according to the present invention
  • FIG. 2 is a schematic structural diagram of a hash entry in an embodiment of the present invention.
  • FIG. 3 is a schematic structural diagram of a linked list information item according to an embodiment of the present invention.
  • FIG. 4 is a flowchart of a second embodiment of a method for managing a hash table according to the present invention.
  • FIG. 5 is a schematic diagram of a first component structure of an apparatus for managing a hash table according to an embodiment of the present invention
  • FIG. 6 is a schematic diagram of a second component structure of an apparatus for managing a hash table according to an embodiment of the present invention.
  • FIG. 7 is a schematic diagram of an internal structure of a root table lookup module according to an embodiment of the present invention.
  • FIG. 8 is a schematic diagram of an internal structure of a linked list lookup module according to an embodiment of the present invention.
  • FIG. 9 is a schematic diagram of an internal structure of a lookup request scheduling module according to an embodiment of the present invention.
  • FIG. 10 is a schematic diagram of an internal structure of a lookup return scheduling module according to an embodiment of the present invention.
  • FIG. 11 is a schematic diagram of an internal structure of a software entry management module according to an embodiment of the present invention.
  • FIG. 1 is a flowchart of a first embodiment of a method for managing a hash table according to the present invention. As shown in FIG. 1, the method includes:
  • Step 10 The hash table corresponding to the hash key value in which the hash conflict occurs is stored by using the linked list, and the hash table corresponding to each hash key value and the linked list information item are stored by using the root table, and the linked list information item is used. Indicates whether there is a hash table entry corresponding to each hash key value in the linked list.
  • the hash entry includes: a hash table entry identifier, a hash table header information n, and a hash table entry n, n. Take an integer greater than 0.
  • the hash table entry identifier is used to identify that the current data is a hash table entry
  • the hash table entry header information n is used to determine the location of the hash table entry n
  • the hash table entry n is a hash corresponding to the hash key value n. Entry.
  • the size of the read data is determined by the bit width of the transmitted data, and the larger the bit width, the more the hash table information obtained, that is, the more the n value is. Big. On the contrary, the smaller the value of n.
  • FIG. 3 is a schematic structural diagram of a linked list information item according to an embodiment of the present invention.
  • the linked list information item includes: a linked list information item representation identifier, a linked list comparison information, and a linked list address information.
  • the linked list information item identifier is used to identify the linked list information item
  • the linked list comparison information is used to indicate Whether the hash table corresponding to the hash key value is stored in the linked list
  • the linked list address information is used to indicate the storage location of the hash table corresponding to the hash key value in the linked list.
  • the linked list information includes: A, B, and C
  • the linked list address information includes: a, b.
  • the actual storage address of the hash entry corresponding to A and B is a
  • the actual storage address of the hash entry corresponding to C is b.
  • Step 11 Obtain a hash key value and a hash table entry to be stored.
  • Step 12 The stored data in the root table is read according to the obtained hash key value; when the linked data item is not included in the read stored data, the hash table item to be stored is stored in the root table; When the linked list information item is included in the read storage data, the hash table item to be stored is stored in the linked list.
  • the stored data in the root table is read according to the obtained hash key value, and the stored data included includes: hash table entry information corresponding to the hash key value stored in the root table, or the root table Linked information items.
  • the linked list information item indicates whether the identifier is 1, and if yes, determining that the stored data includes a linked list information item, and if not, determining that the stored data does not include the linked list information item.
  • the method further includes: performing hash calculation on the obtained hash key value according to the hash function corresponding to the root table, to obtain a first hash value.
  • the first hash value is used to determine whether the hash table corresponding to the hash key value is stored in the root table.
  • f can be a remainder remainder method kmodA (A ⁇ m), a random number method random (k), and the like.
  • the hash table entry to be stored is stored in the root table, and the hash table corresponding to the first hash value exists in the root table, and the first hash value is used in the root table.
  • Read hash table And updating when the obtained hash key value matches the hash key value in the hash table item read in the root table, the hash table item corresponding to the first hash value in the root table is updated to The hash table entry to be stored; the obtained hash key value does not match the hash key value in the hash table entry read in the root table, and the hash table entry still exists in the root table.
  • a hash table entry to be stored is inserted in the root table.
  • the hash table corresponding to the first hash value does not exist in the root table
  • the hash table to be stored is inserted into the root table.
  • the method before using the linked list to store the hash table corresponding to the hash key value of the hash conflict, the method further includes: establishing the linked list.
  • the linked list information item is not included in the read storage data, and the obtained hash key value does not match the hash key value in the hash table entry read in the root table, and the root table is in the root table.
  • a linked list is created, and the hash table to be stored is inserted in the established linked list.
  • the method further includes: updating the linked list information item in the root table based on the hash table item inserted in the linked list.
  • the linked list information item is further used to indicate address information of a hash entry existing in the linked list
  • storing the hash table item to be stored in the linked list may include: performing hash calculation on the obtained hash key value according to the hash function corresponding to the linked list, to obtain a second hash value;
  • the address information of the hash table entry corresponding to the obtained hash key value in the linked list information item is recorded as the third hash value.
  • the hash function corresponding to the linked list is another hash function different from the root table hash function.
  • the second hash value and the third hash value are both obtained by calculating a hash key value through a hash function corresponding to the linked list.
  • the hash table entry is read according to the second hash value in the linked list, and the obtained hash key value and the linked list are read out.
  • Haha in the hash table entry When the hash key value is matched, the hash table corresponding to the second hash value in the linked list is updated to the hash table to be stored; in the obtained hash key value and the read hash table entry When the hash key values do not match, the hash table entry to be stored is inserted in the linked list.
  • a hash table entry to be stored is inserted in the linked list.
  • the method further includes: updating the linked list information item based on the inserted hash table item.
  • the method when storing the hash table to be stored, the method further includes: presetting a first storage space and a second storage space, where the capacity of the second storage space is greater than a capacity of the first storage space;
  • the hash table entries in the table are stored in the first storage space or the second storage space, and the hash table entries in the linked list are stored in the second storage space.
  • the second storage space may be of any size, so that a large-capacity hash table entry or a hash table entry that generates a hash conflict is stored in the second storage space, and the storage location of the hash table entry is implemented.
  • Flexible management increases the number of hash collisions.
  • the conflicted hash table entry needs to be stored in the linked list, and the linked list information item may be in the format shown in FIG. Stored in the storage unit where the hash conflict exists in the root table, so that when the hash table item with the hash conflict is searched, the linked list information item can be returned, thereby further searching for the conflict hash table item saved in the linked list. .
  • the method may further include searching for a corresponding hash table entry according to the input key value.
  • the method for finding a hash entry may include:
  • the hash table entry is searched in the root table according to the search key value, and the hash table entry search result is obtained;
  • the hash table entry corresponding to the lookup key value does not exist in the hash table entry search result indicating list. Determining, in the hash table entry search result, a hash table entry corresponding to the lookup key value in the root table;
  • the hash table item search is performed in the linked list according to the search key value, and the hash table corresponding to the search key value is obtained. Histology item.
  • a linked list is used to store a hash table entry corresponding to a hash key value in which a hash conflict occurs, and a root table is used to store a hash table entry corresponding to each hash key value and a linked list information item, where the linked list information is used.
  • the item is used to indicate whether there is a hash table entry corresponding to each hash key value in the linked list; obtaining a hash key value and a hash table item to be stored; and reading the storage in the root table according to the obtained hash key value Data; storing the hash table item to be stored in the root table when the stored data is not included in the stored data; and storing the stored information in the stored data includes the linked list information item
  • the hash table entries are stored in the linked list. In this way, the number of hash collisions is increased.
  • FIG. 4 is a flowchart of a second embodiment of a method for managing a hash table according to the present invention, the method includes:
  • Step 40 Enter the hash entry information to be stored.
  • the hash entry information to be stored may include: a hash table to be stored, a key value corresponding to the hash table to be stored, a key type and size, and the like.
  • Step 41 The storage address obtained according to the hash table entry information accesses the root table to read the stored data.
  • the first hash value is obtained by using the first hash function to calculate the key value in the hash table item information, where the first hash value may be the corresponding hash table item in the root table.
  • the storage address can also be an offset address, plus the base address to get the final storage address.
  • the stored data in the root table is accessed through the obtained storage address.
  • the obtained storage data may be: hash table item information stored in the root table, or root The linked list information item in the table.
  • the hash table entry of the same key value can be found in the root table according to the key value corresponding to the hash table to be stored, the hash table entry is directly obtained, and when the hash table entry of the same key value is not found, , get the linked list information item.
  • the purpose of accessing the data in the storage address is to determine whether the currently input hash table item information is used to update the existing item information in the root table or the linked list, or as a new hash table.
  • the item information is inserted into the root or linked list.
  • Step 42 Determine whether the obtained data is a linked list information item. If yes, go to step 43; if no, go to step 44.
  • the purpose of determining whether the obtained data is a linked list information item is: determining whether the input storage information is stored in the root table or in the linked list.
  • whether the obtained data is a linked list information item can be determined by determining whether there is a linked list information item representation identifier in the read data.
  • Step 43 Obtain a second hash value corresponding to the key value, determine whether a third hash value equal to the second hash value is stored in the linked list information item, and if yes, execute step 431; if no, execute step 432.
  • the second hash function is used to calculate the key value in the stored information to obtain the second hash value, and the second hash value is compared with all the third hashes stored in the linked list comparison information in the linked list information item.
  • Value comparison when there is a third hash value equal to the second hash value, indicating that the storage information at this time is used to update the hash table entry in the linked list; when there is no equal value to the second hash value
  • the third hash value indicates that the storage information at this time is inserted into the linked list as a new hash table entry.
  • Step 431 Determine, according to the entry information corresponding to the second hash value in the linked list, whether the key value corresponding to the hash entry is equal to the input key value. If yes, go to step 45; if no, go to step 432.
  • Step 432 Determine whether the linked list is full. If yes, go to step 46; if no, go to step 433.
  • Step 433 Insert the information of the hash table item to be stored into the linked list, and update the linked list information item in the root table.
  • the second hash value corresponding to the key value in the stored information needs to be stored in the linked list comparison information of the linked list information item.
  • the linked list address information is updated at the same time, and the storage address is allocated for the hash table corresponding to the second hash value.
  • step 47 is performed.
  • Step 44 Determine whether the hash table entry read from the root table is valid. If yes, go to step 442; if no, go to step 441.
  • the method for determining whether the hash entry is valid may be: determining whether the valid identifier of the hash entry in the header information of the hash table entry is 1 by using the stored data, and if yes, indicating that the current read is The hashed entry is valid; if not, it means that no data is included in the read data. In this case, you need to insert the information to be stored into the root table.
  • Step 441 After the hash table item information to be stored is inserted into the root table, step 47 is performed.
  • Step 442 Determine whether the key value corresponding to the hash entry is equal to the input key value. If yes, go to step 45; if no, go to step 443.
  • Step 443 Determine whether the root table is full. If yes, go to step 444; if no, go to step 441.
  • Step 444 Apply to establish a linked list for storing input information, and determine whether the application is successful. If yes, go to step 445; if no, go to step 46.
  • Step 445 The input information is stored in the linked list, and the linked list information item in the root table is updated, and step 47 is performed.
  • Step 45 Update the corresponding hash table item information in the table by using the input hash table item information.
  • step 47 is performed.
  • Step 46 The storage fails.
  • Step 47 The storage ends.
  • the hash table entry information to be stored is the same as the root table update and insertion process.
  • the linked list information item in the root table needs to be performed. Update, and when updating the linked list, only need to replace the corresponding hash table item information does not need to update the linked list information item.
  • the user when the information of the hash table item needs to be queried, the user only needs to input the query information, where the query information includes: the key value, the key type and the size of the hash table item to be queried.
  • the query process and the storage process are the same in the process of reading the data and comparing the key values, but deleting the steps of inserting or updating the hash table entries.
  • FIG. 5 is a schematic diagram of a first component structure of the device for managing a hash table according to an embodiment of the present invention, as shown in FIG.
  • the device includes: a linked list and a root table; wherein
  • a linked list configured to store a hash table entry corresponding to a hash key value in which a hash conflict occurs
  • the root table is configured to store a linked list information item and a hash table entry corresponding to each hash key value, where the linked list information item is used to indicate whether a hash table entry corresponding to each hash key value exists in the linked list;
  • the device further includes: an obtaining module 50 and a processing module 51; wherein
  • the obtaining module 50 is configured to obtain a hash key value and a hash table item to be stored.
  • the processing module 51 is configured to: read the stored data in the root table according to the obtained hash key value; and store the hash table item to be stored to the root when the stored storage data does not include the linked list information item In the table, when the linked data item is included in the read storage data, the hash table item to be stored is stored in the linked list.
  • the processing module 51 is further configured to perform a hash calculation on the obtained hash key value according to a hash function corresponding to the root table, to obtain a first hash value;
  • the processing module 51 is further configured to: in the root table, a hash table entry corresponding to the first hash value, where the hash table entry is read according to the first hash value, When the obtained hash key value matches the hash key value in the hash table entry read in the root table, the hash table corresponding to the first hash value in the root table is updated to be stored.
  • Hash table entry the obtained hash key value does not match the hash key value in the hash table entry read in the root table, and the storage location of the hash table entry still exists in the root table Inserting a hash table entry to be stored in the root table; when there is no hash table entry corresponding to the first hash value in the root table, inserting a hash to be stored in the root table Entry.
  • the processing module 51 is further configured to not include the linked list information item in the read storage data, and the obtained hash key value and the hash key in the hash table item read in the root table If the value does not match, and the storage location of the hash table entry does not exist in the root table, the linked list is created, and the hash table to be stored is inserted in the established linked list.
  • the processing module 51 is further configured to: after inserting the hash table item to be stored in the linked list, update the linked list information item in the root table based on the hash table item inserted in the linked list.
  • the linked list information item is further used to indicate address information of a hash entry existing in the linked list
  • the processing module 51 is further configured to perform hash calculation on the obtained hash key value according to the hash function corresponding to the linked list, to obtain a second hash value, and obtain the hash information information item and the obtained hash value.
  • the address information of the hash table corresponding to the hash key value is recorded as a third hash value;
  • the processing module 51 is further configured to: when the third hash value and the second hash value are the same, read the hash table entry according to the second hash value in the linked list, and obtain the hash When the key value matches the hash key value in the hash table entry read in the linked list, the hash table corresponding to the second hash value in the linked list is updated to the hash table to be stored; Get the hash key value and read it out When the hash key value in the hash table item does not match, the hash table item to be stored is inserted in the linked list; when the third hash value is different from the second hash value, in the linked list Insert the hash table entry to be stored.
  • the processing module 51 is further configured to: after inserting the hash table item to be stored in the linked list, update the linked list information item based on the inserted hash table item.
  • the device further includes: a lookup module
  • the search module is further configured to obtain a lookup key value for performing a hash search; perform a hash table item search in the root table according to the search key value, and obtain a hash table item search result; and search results in the hash table item.
  • the hash table entry corresponding to the search key value exists in the root table
  • the hash table entry corresponding to the search key value in the root table is determined in the hash table entry search result; in the hash table entry If the search result indicates that the hash table corresponding to the search key value does not exist in the root table, the hash table entry is searched in the linked list according to the search key value, and the hash table corresponding to the search key value in the linked list is obtained.
  • the device further includes: a first storage space and a second storage space, wherein the capacity of the second storage space is greater than the capacity of the first storage space;
  • the storage location of the hash table entry in the root table is the first storage space or the second storage space, and the storage location of the hash table entry in the linked list is the second storage space.
  • the first storage space may be an on-chip storage unit inside the device
  • the second storage space may be an off-chip storage unit outside the device
  • the storage space of the off-chip storage unit is large and the on-chip storage unit may be All or part of the root table, and all the linked lists are stored in the off-chip storage unit, improving the working efficiency of the device.
  • the obtaining module 50 and the processing module 51 may each be a Central Processing Unit (CPU), a Micro Processor Unit (MPU), and a Digital Signal Processor (Digital Signal Processor) located in the terminal device. DSP), or Field Programmable Gate Array (FPGA) implementation.
  • CPU Central Processing Unit
  • MPU Micro Processor Unit
  • DSP Digital Signal Processor
  • FPGA Field Programmable Gate Array
  • FIG. 6 is a schematic diagram of a second component structure of an apparatus for managing a hash table according to an embodiment of the present invention.
  • the apparatus may include: a user interface 101, a root table lookup module 102, a linked list lookup module 103, a lookup request scheduling module 104, and an external storage management module. 105.
  • the user interface 101, the root table lookup module 102, the linked list lookup module 103, the lookup request scheduling module 104, the external storage management module 105, and the lookup return scheduling module 107 are used for lookup management of the hash table entries.
  • the software entry management module 108 manages the storage of the hash entries.
  • the external storage module 106 and the internal storage module 109 are configured to implement flexible storage of hash entries.
  • FIG. 7 is a schematic diagram of an internal structure of a root table lookup module according to an embodiment of the present invention.
  • the root table lookup module includes: a root table cache unit 201, a root table parsing unit 202, and a root table processing unit 203.
  • the root table lookup module 102 receives the lookup information transmitted by the user interface 101, and the search information includes: a key value, a key type and a size, etc.; the lookup information is placed in the root table cache unit 201, and the key value is sent to the inside of the device.
  • the internal storage module 109 calculates a first hash value according to the key value, and the return data corresponding to the first hash value is sent to the root table processing unit 203; and the root table parsing unit 202 also calculates the key value according to the key value.
  • the first hash value is generated and sent to the lookup request scheduling module 104.
  • the lookup request may include: all the search information, a trigger signal indicating the search for the external storage module 106, and the like.
  • the lookup request scheduling module 104 requests the external storage module to search for the corresponding hash table entry, and sends the return data corresponding to the first hash value to the root table processing unit 203; the root table processing unit 203 reads the lookup from the cache unit 201.
  • the information is matched with the obtained return data. If it matches, indicating that the returned data contains the hash table corresponding to the key value, the return data is directly sent to the lookup return scheduling module 107, and the structure of the returned data is as shown in the figure. 2; if it does not match, it means that the returned data does not contain the hash table corresponding to the key value, and needs to perform the linked list lookup. At this time, the lookup request is initiated to the linked list lookup module 103, and the structure of the linked list information item in the returned data is as shown in FIG. 3 is shown.
  • the list lookup is automatically performed by parsing the linked list information item, thereby improving the search efficiency of the entry.
  • the root table processing unit 203 reads the lookup information from the root table cache unit 201 and matches the obtained return data, including: the key value, the key type and the size in the search information, and the returned data.
  • the information such as the key value, the key type, and the size of the hash table item are compared one by one. When all the information is the same, it is determined that the data matches, and the returned data includes the hash table item to be searched; if at least one item is not The same, to determine the data does not match, the returned data does not contain the hash table item to be found.
  • FIG. 8 is a schematic diagram of an internal structure of a linked list lookup module according to an embodiment of the present invention.
  • the linked list lookup module includes: a linked list cache unit 301, a linked list parsing unit 302, and a linked list processing unit 303.
  • the root table lookup module 102 initiates the lookup request to the linked list lookup module 103
  • the lookup request is stored in the linked list cache unit 301 and the linked list parsing unit 302.
  • the linked list parsing unit 302 parses the lookup request and sends it to the lookup request scheduling module 104 for a lookup request.
  • the scheduling module 104 applies to the external storage management module 105 for a corresponding query operation, and the external storage management module 105 completes the query to the external storage module 106 and returns the query result to the linked list processing unit 303; the linked list processing unit 303 reads from the linked list cache unit 301.
  • the lookup information contained in the lookup request is compared and compared with the obtained query result, and the comparison result is sent to the lookup return scheduling module 107.
  • the hash table corresponding to the key value is found in the linked list
  • the obtained hash table entry is returned; when the hash table corresponding to the key value is not found in the linked list, the prompt information may be returned Find the corresponding hash table entry.
  • FIG. 9 is a schematic diagram of an internal structure of a lookup request scheduling module according to an embodiment of the present invention, as shown in FIG.
  • the lookup request scheduling module 104 includes a root table lookup cache unit 401, a linked list lookup cache unit 402, and a lookup request scheduling unit 403.
  • the root table lookup cache unit 401 and the linked list lookup cache unit 402 cache the lookup requests generated by the root table parsing unit 202 and the linked list parsing unit 302, respectively.
  • the lookup request scheduling unit 403 after reading the lookup request in the two cache units, adds a lookup type flag to the lookup request and sends it to the external storage management module 105.
  • the search type identifier can identify whether the current table content or the linked list content needs to be searched.
  • a search type flag bit can be set to distinguish the current search object.
  • the search type flag bit is 1, the search object is The entry information in the root table; when the lookup type flag is 0, it indicates that the search object is the entry information in the linked list. You can improve the efficiency of finding hash entries by setting the lookup type identifier.
  • the lookup return scheduling module 107 includes a root table lookup result buffering unit 701, a linked list lookup result buffering unit 702, and a lookup returning scheduling unit 703.
  • the root table search result buffer unit 701 and the linked list search result buffer unit 702 respectively cache the lookup return results generated by the root table processing unit 303 and the linked list processing unit 403, and the lookup return scheduling unit 703 reads the search results in the two cache units, and It is returned to the user via the user interface 101.
  • FIG. 11 is a schematic diagram of an internal structure of a software entry management module according to an embodiment of the present invention.
  • the software entry management module 108 may include: a master device 801, a software management unit 802, and a software cache unit 803.
  • the master device 801 When storing the hash table entry, the master device 801 first determines whether the hash table entry is stored in the root table or the linked list by the software management unit 802. After determining the storage location of the hash table entry storage, the software management unit 802 The hash table entry is first cached into the software cache unit 803, and the software cache is interconnected by a peripheral component (Peripheral Component Interconnect Express, The PCIE) interface is written to the external storage module 106.
  • a peripheral component Peripheral Component Interconnect Express, The PCIE
  • the root table and the linked list may be stored in the external storage module; or the smaller hash entries in the root table may be stored in the internal storage module. , store the large hash table entries in the external storage module.
  • the hash table entry management device may adopt a pipeline method when performing hash table item search, for an entry of the same level entry, that is, an entry of the same root table or a linked list. Because the storage location and the discovery process are consistent, the lookup interface can perform sequential lookups for the same level of lookup. For different levels of lookup, that is, the searched entries are in the root table and the linked list, and the lookup interface can also be searched according to the order in which the lookup requests are obtained.
  • the storage management of the hash entry may be implemented at the same time. If an error occurs in the process of storing the entry, the error identifier may be returned to the hash table item management device, and then The error condition is handled by the management device, for example, re-storing the entry or blocking the lookup of the error entry.
  • embodiments of the present invention can be provided as a method, system, or computer program product. Accordingly, the present invention can take the form of a hardware embodiment, a software embodiment, or a combination of software and hardware. Moreover, the invention can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) including computer usable program code.
  • the computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device.
  • the apparatus implements the functions specified in one or more blocks of a flow or a flow and/or block diagram of the flowchart.
  • These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are performed on a computer or other programmable device to produce computer-implemented processing for execution on a computer or other programmable device.
  • the instructions provide steps for implementing the functions specified in one or more of the flow or in a block or blocks of a flow diagram.
  • an embodiment of the present invention further provides a computer storage medium, wherein a computer program is configured, and the computer program is configured to perform a hash table management method according to an embodiment of the present invention.
  • the technical solution of the embodiment of the present invention uses a linked list to store a hash table entry corresponding to a hash key value in which a hash conflict occurs, and uses a root table to store a hash table entry corresponding to each hash key value, and a linked list information item.
  • the linked list information item is used to indicate whether there is a hash table corresponding to each hash key value in the linked list; obtaining a hash key value and a hash table item to be stored; and reading the root table according to the obtained hash key value; Storage data; when the stored data is not included in the stored data, the hash table item to be stored is stored in the root table; when the stored data includes the linked list information item, the The hash table items to be stored are stored in the linked list. In this way, the number of hash collisions is increased.

Abstract

Disclosed is a Hash table management method, comprising: using a chain table to store Hash table entries corresponding to Hash key values where Hash conflicts occur, and using a root table to store a Hash table entry corresponding to each Hash key value and chain table information entries, the chain table information entries being used for indicating whether the chain table has the Hash table entry corresponding to each Hash key value; obtaining the Hash key values and Hash table entries to be stored; reading storage data in the root table according to the obtained Hash key values; storing the Hash table entries to be stored in the root table when the read storage data excludes the chain table information entries; and storing the Hash table entries to be stored in the chain table when the read storage data includes the chain table information entries. Also disclosed is a Hash table management device.

Description

一种哈希表管理的方法和装置、计算机存储介质Method and device for managing hash table, computer storage medium
相关申请的交叉引用Cross-reference to related applications
本申请基于申请号为201611102346.8、申请日为2016年12月02日的中国专利申请提出,并要求该中国专利申请的优先权,该中国专利申请的全部内容在此引入本申请作为参考。The present application is filed on the basis of the Chinese Patent Application Serial No. No. No. No. No. No. No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No
技术领域Technical field
本发明涉及通信技术领域,尤其涉及一种哈希表管理的方法和装置、计算机存储介质。The present invention relates to the field of communications technologies, and in particular, to a method and apparatus for managing a hash table, and a computer storage medium.
背景技术Background technique
网络处理器是网络应用领域涉及的专用指令处理器,它专为网络分组处理而设计,可以使得网络系统具备高性能和高灵活性等特点。The network processor is a dedicated instruction processor involved in the field of network applications. It is designed for network packet processing and can make the network system have high performance and high flexibility.
网络处理器在进行信息查找时多使用哈希表来建立信息的索引关系,从而实现信息的快速查找。这里,哈希表中使用哈希(Hash)算法来建立索引关系,这种方法的基本思想是:在查找键值k和对应信息的存储位置p之间建立一个对应关系f,使得p=f(k),f即为一种哈希算法。在使用网络处理器进行信息查询时,利用哈希算法计算键值对应的哈希表项信息的存储地址,这样便可以直接通过存储地址查找到键值对应的哈希表项信息。The network processor uses a hash table to establish an index relationship of information when performing information search, thereby realizing quick information search. Here, the hash table uses a hash algorithm to establish an index relationship. The basic idea of this method is to establish a correspondence f between the search key value k and the storage location p of the corresponding information, so that p=f (k), f is a hash algorithm. When the network processor is used for information query, the hash algorithm is used to calculate the storage address of the hash table item information corresponding to the key value, so that the hash table item information corresponding to the key value can be directly found through the storage address.
但是在使用哈希表进行信息查询时,不同的键值可能会映射到哈希表中同一存储地址上,即k1≠k2,但f(k1)=f(k2),这种现象称为哈希冲突,如何解决哈希冲突已经成为提高网络处理器性能的关键问题。 However, when using a hash table for information query, different key values may be mapped to the same storage address in the hash table, ie k1≠k2, but f(k1)=f(k2). This phenomenon is called ha. Greek conflict, how to solve the hash conflict has become a key issue to improve the performance of network processors.
发明内容Summary of the invention
为解决上述技术问题,本发明实施例期望提供一种哈希表管理的方法和装置、计算机存储介质,提高哈希冲突容纳的数量。In order to solve the above technical problem, embodiments of the present invention are expected to provide a method and apparatus for hash table management, and a computer storage medium, which improve the number of hash collisions.
本发明的技术方案是这样实现的:The technical solution of the present invention is implemented as follows:
本发明实施例提供了一种哈希表管理的方法,包括:The embodiment of the invention provides a method for managing a hash table, including:
使用链表存储发生哈希冲突的哈希键值对应的哈希表项,使用根表存储各个哈希键值对应的哈希表项、以及链表信息项,所述链表信息项用于指示链表中是否存在每个哈希键值对应的哈希表项;The linked list is used to store the hash table corresponding to the hash key value of the hash conflict, and the root table is used to store the hash table corresponding to each hash key value and the linked list information item, where the linked list information item is used to indicate the linked list. Whether there is a hash table entry corresponding to each hash key value;
获取哈希键值以及待存储的哈希表项;Obtaining a hash key value and a hash table item to be stored;
依据所获取的哈希键值读取根表中的存储数据;在读取的存储数据中不包括链表信息项时,将所述待存储的哈希表项存储至根表中;在读取的存储数据中包括链表信息项时,将所述待存储的哈希表项存储至链表中。Reading the stored data in the root table according to the obtained hash key value; storing the hash table item to be stored in the root table when the stored storage data does not include the linked list information item; When the stored data includes the linked list information item, the hash table item to be stored is stored in the linked list.
上述方案中,在获取哈希键值后,所述方法还包括:根据所述根表对应的哈希函数,对所获取的哈希键值进行哈希计算,得到第一哈希值;In the above solution, after obtaining the hash key value, the method further includes: performing a hash calculation on the obtained hash key value according to the hash function corresponding to the root table, to obtain a first hash value;
所述将所述待存储的哈希表项存储至根表中,包括:The storing the hash table item to be stored into the root table includes:
所述根表中存在第一哈希值对应的哈希表项,在所述根表中根据第一哈希值读取哈希表项,在所获取的哈希键值与根表中读取出的哈希表项中的哈希键值匹配时,将所述根表中第一哈希值对应的哈希表项更新为待存储的哈希表项;在所获取的哈希键值与根表中读取出的哈希表项中的哈希键值不匹配,且所述根表中还存在哈希表项的存储位置时,在所述根表中插入待存储的哈希表项;The hash table corresponding to the first hash value exists in the root table, and the hash table entry is read according to the first hash value in the root table, and the obtained hash key value and the root table are read. When the hash key value in the extracted hash table item matches, the hash table corresponding to the first hash value in the root table is updated to the hash table item to be stored; the obtained hash key is obtained. If the value does not match the hash key value in the hash table entry read in the root table, and the storage location of the hash table entry still exists in the root table, insert the to-be-stored in the root table. History entry
所述根表中不存在第一哈希值对应的哈希表项时,在所述根表中插入待存储的哈希表项。When the hash table corresponding to the first hash value does not exist in the root table, the hash table entry to be stored is inserted into the root table.
上述方案中,所述使用链表存储发生哈希冲突的哈希键值对应的哈希表项,包括: In the above solution, the using the linked list to store the hash table corresponding to the hash key value of the hash conflict, including:
在读取的存储数据中不包括链表信息项,且所获取的哈希键值与根表中读取出的哈希表项中的哈希键值不匹配,且所述根表中不存在哈希表项的存储位置时,建立链表,在建立的链表中插入待存储的哈希表项。The linked list information item is not included in the read storage data, and the obtained hash key value does not match the hash key value in the hash table entry read in the root table, and the root table does not exist. When the storage location of the hash entry is set, a linked list is created, and the hash table to be stored is inserted in the created linked list.
上述方案中,在所述链表中插入待存储的哈希表项后,所述方法还包括:基于链表中插入的哈希表项,在所述根表中更新链表信息项。In the above solution, after the hash table item to be stored is inserted in the linked list, the method further includes: updating the linked list information item in the root table based on the hash table item inserted in the linked list.
上述方案中,所述链表信息项还用于指示链表中存在的哈希表项的地址信息;In the above solution, the linked list information item is further used to indicate address information of a hash entry existing in the linked list;
所述将所述待存储的哈希表项存储至链表中,包括:The storing the hash table item to be stored into the linked list includes:
根据所述链表对应的哈希函数,对所获取的哈希键值进行哈希计算,得到第二哈希值;将所述链表信息项中与获取的哈希键值对应的哈希表项的地址信息记为第三哈希值;Performing a hash calculation on the obtained hash key value according to the hash function corresponding to the linked list to obtain a second hash value; and hashing the hash table key corresponding to the obtained hash key value in the linked list information item The address information is recorded as a third hash value;
在所述第三哈希值与第二哈希值相同时,在所述链表中根据第二哈希值读取哈希表项,在所获取的哈希键值与链表中读取出的哈希表项中的哈希键值匹配时,将所述链表中第二哈希值对应的哈希表项更新为待存储的哈希表项;在所获取的哈希键值与读取出的哈希表项中的哈希键值不匹配时,在所述链表中插入待存储的哈希表项;When the third hash value is the same as the second hash value, the hash table entry is read according to the second hash value in the linked list, and the obtained hash key value and the linked list are read out. When the hash key value in the hash table matches, the hash table corresponding to the second hash value in the linked list is updated to the hash table to be stored; the hash key value and the read are obtained. When the hash key values in the hash table entries do not match, the hash table entries to be stored are inserted into the linked list;
在所述第三哈希值与第二哈希值不相同时,在所述链表中插入待存储的哈希表项。When the third hash value is different from the second hash value, a hash table entry to be stored is inserted in the linked list.
上述方案中,在所述链表中插入待存储的哈希表项后,所述方法包括:基于插入的哈希表项更新链表信息项。In the above solution, after the hash table item to be stored is inserted in the linked list, the method includes: updating the linked list information item based on the inserted hash table item.
上述方案中,所述方法还包括:In the above solution, the method further includes:
获取用于进行哈希查找的查找键值;Get the lookup key value used to perform the hash lookup;
根据查找键值在根表中进行哈希表项查找,得到哈希表项查找结果;The hash table entry is searched in the root table according to the search key value, and the hash table entry search result is obtained;
在哈希表项查找结果指示根表中存在所述查找键值对应的哈希表项时,在所述哈希表项查找结果中确定根表中与所述查找键值对应的哈希表 项;When the hash table entry search result indicates that the hash table corresponding to the search key value exists in the root table, determining a hash table corresponding to the search key value in the root table in the hash table entry search result item;
在哈希表项查找结果指示根表中不存在所述查找键值对应的哈希表项时,根据查找键值在链表中进行哈希表项查找,得到链表中与所述查找键值对应的哈希表项。When the hash table entry search result indicates that the hash table corresponding to the search key value does not exist in the root table, the hash table entry is searched in the linked list according to the search key value, and the linked list is matched with the search key value. Hash table entry.
上述方案中,所述方法还包括:预先设置第一存储空间和第二存储空间,所述第二存储空间的容量大于第一存储空间的容量;In the above solution, the method further includes: presetting a first storage space and a second storage space, where the capacity of the second storage space is greater than the capacity of the first storage space;
将所述根表中的哈希表项存储于第一存储空间或第二存储空间,将所述链表中的哈希表项存储于第二存储空间。The hash table entries in the root table are stored in the first storage space or the second storage space, and the hash table entries in the linked list are stored in the second storage space.
本发明实施例还提供了一种哈希表管理的装置,所述装置包括:链表和根表,其中:The embodiment of the invention further provides a device for managing a hash table, the device comprising: a linked list and a root table, wherein:
链表,配置为存储发生哈希冲突的哈希键值对应的哈希表项;a linked list configured to store a hash table entry corresponding to a hash key value in which a hash conflict occurs;
根表,配置为存储链表信息项和各个哈希键值对应的哈希表项,所述链表信息项用于指示链表中是否存在每个哈希键值对应的哈希表项;The root table is configured to store a linked list information item and a hash table entry corresponding to each hash key value, where the linked list information item is used to indicate whether a hash table entry corresponding to each hash key value exists in the linked list;
所述装置还包括:获取模块和处理模块;其中,The device further includes: an obtaining module and a processing module; wherein
获取模块,配置为获取哈希键值以及待存储的哈希表项;Obtaining a module, configured to obtain a hash key value and a hash table item to be stored;
处理模块,配置为依据所获取的哈希键值读取根表中的存储数据;在读取的存储数据中不包括链表信息项时,将所述待存储的哈希表项存储至根表中;在读取的存储数据中包括链表信息项时,将所述待存储的哈希表项存储至链表中。The processing module is configured to: read the stored data in the root table according to the obtained hash key value; and store the hash table item to be stored to the root table when the stored storage data does not include the linked list information item The hash table item to be stored is stored in the linked list when the linked list information item is included in the read storage data.
上述方案中,所述处理模块,还配置为根据所述根表对应的哈希函数,对所获取的哈希键值进行哈希计算,得到第一哈希值;In the above solution, the processing module is further configured to perform hash calculation on the obtained hash key value according to a hash function corresponding to the root table, to obtain a first hash value;
相应地,所述处理模块,还配置为在所述根表中存在第一哈希值对应的哈希表项,在所述根表中根据第一哈希值读取哈希表项,在所获取的哈希键值与根表中读取出的哈希表项中的哈希键值匹配时,将所述根表中第一哈希值对应的哈希表项更新为待存储的哈希表项;在所获取的哈希键值 与根表中读取出的哈希表项中的哈希键值不匹配,且所述根表中还存在哈希表项的存储位置时,在所述根表中插入待存储的哈希表项;在所述根表中不存在第一哈希值对应的哈希表项时,在所述根表中插入待存储的哈希表项。Correspondingly, the processing module is further configured to: in the root table, a hash table entry corresponding to the first hash value, where the hash table entry is read according to the first hash value, When the obtained hash key value matches the hash key value in the hash table entry read in the root table, the hash table corresponding to the first hash value in the root table is updated to be stored. Hash table entry; the hash key value obtained If the hash key value in the hash table entry read in the root table does not match, and the storage location of the hash table entry still exists in the root table, insert the hash to be stored in the root table. An entry of the hash table to be stored in the root table when the hash table corresponding to the first hash value does not exist in the root table.
上述方案中,所述处理模块,还配置为在读取的存储数据中不包括链表信息项,且所获取的哈希键值与根表中读取出的哈希表项中的哈希键值不匹配,且所述根表中不存在哈希表项的存储位置时,建立链表,在建立的链表中插入待存储的哈希表项。In the above solution, the processing module is further configured to not include the linked list information item in the read storage data, and the obtained hash key value and the hash key in the hash table item read in the root table If the value does not match, and the storage location of the hash table entry does not exist in the root table, the linked list is created, and the hash table to be stored is inserted in the established linked list.
上述方案中,所述处理模块,还配置为在所述链表中插入待存储的哈希表项后,基于链表中插入的哈希表项,在所述根表中更新链表信息项。In the above solution, the processing module is further configured to: after inserting the hash table item to be stored in the linked list, update the linked list information item in the root table based on the hash table item inserted in the linked list.
上述方案中,所述链表信息项还用于指示链表中存在的哈希表项的地址信息;In the above solution, the linked list information item is further used to indicate address information of a hash entry existing in the linked list;
所述处理模块,还配置为根据所述链表对应的哈希函数,对所获取的哈希键值进行哈希计算,得到第二哈希值;将所述链表信息项中与获取的哈希键值对应的哈希表项的地址信息记为第三哈希值;The processing module is further configured to perform a hash calculation on the obtained hash key value according to the hash function corresponding to the linked list, to obtain a second hash value, and obtain the hash in the linked list information item. The address information of the hash table corresponding to the key value is recorded as a third hash value;
所述处理模块,还配置为在所述第三哈希值与第二哈希值相同时,在所述链表中根据第二哈希值读取哈希表项,在所获取的哈希键值与链表中读取出的哈希表项中的哈希键值匹配时,将所述链表中第二哈希值对应的哈希表项更新为待存储的哈希表项;在所获取的哈希键值与读取出的哈希表项中的哈希键值不匹配时,在所述链表中插入待存储的哈希表项;在所述第三哈希值与第二哈希值不相同时,在所述链表中插入待存储的哈希表项。The processing module is further configured to: when the third hash value and the second hash value are the same, read the hash table entry according to the second hash value in the linked list, and obtain the hash key When the value matches the hash key value in the hash table entry in the linked list, the hash table corresponding to the second hash value in the linked list is updated to the hash table to be stored; When the hash key value does not match the hash key value in the read hash table entry, the hash table entry to be stored is inserted in the linked list; the third hash value and the second hash value are When the hash values are different, the hash table entry to be stored is inserted in the linked list.
上述方案中,所述处理模块,还配置为在所述链表中插入待存储的哈希表项后,基于插入的哈希表项更新链表信息项。In the above solution, the processing module is further configured to: after inserting the hash table item to be stored in the linked list, update the linked list information item based on the inserted hash table item.
上述方案中,所述装置还包括:查找模块; In the above solution, the device further includes: a lookup module;
所述查找模块,还配置为获取用于进行哈希查找的查找键值;根据查找键值在根表中进行哈希表项查找,得到哈希表项查找结果;在哈希表项查找结果指示根表中存在所述查找键值对应的哈希表项时,在所述哈希表项查找结果中确定根表中与所述查找键值对应的哈希表项;在哈希表项查找结果指示根表中不存在所述查找键值对应的哈希表项时,根据查找键值在链表中进行哈希表项查找,得到链表中与所述查找键值对应的哈希表项。The search module is further configured to obtain a lookup key value for performing a hash search; perform a hash table item search in the root table according to the search key value, and obtain a hash table item search result; and search results in the hash table item. When the hash table entry corresponding to the search key value exists in the root table, the hash table entry corresponding to the search key value in the root table is determined in the hash table entry search result; in the hash table entry If the search result indicates that the hash table corresponding to the search key value does not exist in the root table, the hash table entry is searched in the linked list according to the search key value, and the hash table corresponding to the search key value in the linked list is obtained. .
上述方案中,所述装置还包括:第一存储空间和第二存储空间,所述第二存储空间的容量大于第一存储空间的容量;In the above solution, the device further includes: a first storage space and a second storage space, where the capacity of the second storage space is greater than the capacity of the first storage space;
所述根表中的哈希表项的存储位置为第一存储空间或第二存储空间,所述链表中的哈希表项的存储位置为第二存储空间。The storage location of the hash table entry in the root table is the first storage space or the second storage space, and the storage location of the hash table entry in the linked list is the second storage space.
本发明实施例还提供一种计算机存储介质,该计算机存储介质存储有计算机程序,该计算机程序配置为执行上述哈希表管理的方法。Embodiments of the present invention also provide a computer storage medium storing a computer program configured to perform the method of hash table management described above.
本发明实施例提供的一种哈希表管理的方法和装置、计算机存储介质,使用链表存储发生哈希冲突的哈希键值对应的哈希表项,使用根表存储各个哈希键值对应的哈希表项、以及链表信息项,所述链表信息项用于指示链表中是否存在每个哈希键值对应的哈希表项;获取哈希键值以及待存储的哈希表项;依据所获取的哈希键值读取根表中的存储数据;在读取的存储数据中不包括链表信息项时,将所述待存储的哈希表项存储至根表中;在读取的存储数据中包括链表信息项时,将所述待存储的哈希表项存储至链表中。如此,提高了哈希冲突容纳的数量。A method and device for managing hash table according to an embodiment of the present invention, and a computer storage medium, use a linked list to store a hash table entry corresponding to a hash key value in which a hash conflict occurs, and use a root table to store each hash key value corresponding to the hash table. a hash table entry, and a linked list information item, the linked list information item is used to indicate whether there is a hash table entry corresponding to each hash key value in the linked list; obtaining a hash key value and a hash table entry to be stored; Reading the stored data in the root table according to the obtained hash key value; storing the hash table item to be stored in the root table when the stored storage data does not include the linked list information item; When the stored data includes the linked list information item, the hash table item to be stored is stored in the linked list. In this way, the number of hash collisions is increased.
附图说明DRAWINGS
图1为本发明哈希表管理的方法的第一实施例的流程图;1 is a flow chart of a first embodiment of a method for managing hash table according to the present invention;
图2为本发明实施例中哈希表项的结构示意图;2 is a schematic structural diagram of a hash entry in an embodiment of the present invention;
图3为本发明实施例中链表信息项的结构示意图;3 is a schematic structural diagram of a linked list information item according to an embodiment of the present invention;
图4为本发明哈希表管理的方法的第二实施例的流程图; 4 is a flowchart of a second embodiment of a method for managing a hash table according to the present invention;
图5为本发明实施例哈希表管理的装置的第一组成结构示意图;FIG. 5 is a schematic diagram of a first component structure of an apparatus for managing a hash table according to an embodiment of the present invention; FIG.
图6为本发明实施例哈希表管理的装置的第二组成结构示意图;6 is a schematic diagram of a second component structure of an apparatus for managing a hash table according to an embodiment of the present invention;
图7为本发明实施例中根表查找模块内部结构示意图;7 is a schematic diagram of an internal structure of a root table lookup module according to an embodiment of the present invention;
图8为本发明实施例中链表查找模块内部结构示意图;8 is a schematic diagram of an internal structure of a linked list lookup module according to an embodiment of the present invention;
图9为本发明实施例中查找请求调度模块内部结构示意图;FIG. 9 is a schematic diagram of an internal structure of a lookup request scheduling module according to an embodiment of the present invention;
图10为本发明实施例中查找返回调度模块内部结构示意图;FIG. 10 is a schematic diagram of an internal structure of a lookup return scheduling module according to an embodiment of the present invention;
图11为本发明实施例中软件表项管理模块内部结构示意图。FIG. 11 is a schematic diagram of an internal structure of a software entry management module according to an embodiment of the present invention.
具体实施方式detailed description
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述。The technical solutions in the embodiments of the present invention will be clearly and completely described in the following with reference to the accompanying drawings.
图1为本发明哈希表管理的方法的第一实施例的流程图,如图1所示,该方法包括:1 is a flowchart of a first embodiment of a method for managing a hash table according to the present invention. As shown in FIG. 1, the method includes:
步骤10:使用链表存储发生哈希冲突的哈希键值对应的哈希表项,使用根表存储各个哈希键值对应的哈希表项、以及链表信息项,所述链表信息项用于指示链表中是否存在每个哈希键值对应的哈希表项。Step 10: The hash table corresponding to the hash key value in which the hash conflict occurs is stored by using the linked list, and the hash table corresponding to each hash key value and the linked list information item are stored by using the root table, and the linked list information item is used. Indicates whether there is a hash table entry corresponding to each hash key value in the linked list.
图2为本发明实施例中哈希表项的结构示意图,如图2所示,哈希表项包括:哈希表项表示标识、哈希表项头信息n和哈希表项n,n取大于0的整数。哈希表项表示标识用于标识当前数据为哈希表项,哈希表项头信息n用于确定哈希表项n的位置,哈希表项n为哈希键值n对应的哈希表项。需要说明的是,在对哈希表项信息进行读取时,由于读取数据的大小是由传输数据的位宽而决定,位宽越大获得的哈希表项信息越多即n值越大。相反n值越小。2 is a schematic structural diagram of a hash entry in the embodiment of the present invention. As shown in FIG. 2, the hash entry includes: a hash table entry identifier, a hash table header information n, and a hash table entry n, n. Take an integer greater than 0. The hash table entry identifier is used to identify that the current data is a hash table entry, the hash table entry header information n is used to determine the location of the hash table entry n, and the hash table entry n is a hash corresponding to the hash key value n. Entry. It should be noted that, when the hash table item information is read, the size of the read data is determined by the bit width of the transmitted data, and the larger the bit width, the more the hash table information obtained, that is, the more the n value is. Big. On the contrary, the smaller the value of n.
图3为本发明实施例中链表信息项的结构示意图,如图3所示,链表信息项的组成包括:链表信息项表示标识、链表比对信息和链表地址信息。其中,链表信息项表示标识用于标识链表信息项,链表比对信息用于指示 哈希键值对应的哈希表项是否存储在链表中,链表地址信息用于指示哈希键值对应的哈希表项在链表中的存储位置。例如,链表比对信息包括:A、B、C;链表地址信息包括:a、b。其中,A、B对应的哈希表项的实际存储地址为a,C对应的哈希表项的实际存储地址为b,对待存储的哈希表项信息计算后得到A′,如果A、B、C中的一个与A′相等,说明链表存在对应的哈希表项,且可以确定存储位置;否则说明链表不存在对应的哈希表项。FIG. 3 is a schematic structural diagram of a linked list information item according to an embodiment of the present invention. As shown in FIG. 3, the linked list information item includes: a linked list information item representation identifier, a linked list comparison information, and a linked list address information. The linked list information item identifier is used to identify the linked list information item, and the linked list comparison information is used to indicate Whether the hash table corresponding to the hash key value is stored in the linked list, and the linked list address information is used to indicate the storage location of the hash table corresponding to the hash key value in the linked list. For example, the linked list information includes: A, B, and C; the linked list address information includes: a, b. The actual storage address of the hash entry corresponding to A and B is a, and the actual storage address of the hash entry corresponding to C is b. After the hash table entry information to be stored is calculated, A' is obtained. One of C is equal to A', indicating that there is a corresponding hash table entry in the linked list, and the storage location can be determined; otherwise, the corresponding hash table entry does not exist in the linked list.
步骤11:获取哈希键值以及待存储的哈希表项。Step 11: Obtain a hash key value and a hash table entry to be stored.
步骤12:依据所获取的哈希键值读取根表中的存储数据;在读取的存储数据中不包括链表信息项时,将所述待存储的哈希表项存储至根表中;在读取的存储数据中包括链表信息项时,将所述待存储的哈希表项存储至链表中。Step 12: The stored data in the root table is read according to the obtained hash key value; when the linked data item is not included in the read stored data, the hash table item to be stored is stored in the root table; When the linked list information item is included in the read storage data, the hash table item to be stored is stored in the linked list.
本步骤中,依据所获取的哈希键值读取根表中的存储数据,读取的存储数据中包括:根表中存储的哈希键值对应的哈希表项信息,或者根表的链表信息项。示例性的,可以判断链表信息项表示标识是否为1,如果是,确定存储数据中包括链表信息项,如果否,确定存储数据中不包括链表信息项。In this step, the stored data in the root table is read according to the obtained hash key value, and the stored data included includes: hash table entry information corresponding to the hash key value stored in the root table, or the root table Linked information items. Exemplarily, it may be determined whether the linked list information item indicates whether the identifier is 1, and if yes, determining that the stored data includes a linked list information item, and if not, determining that the stored data does not include the linked list information item.
在实际实施时,在获取哈希键值后,所述方法还包括:根据所述根表对应的哈希函数,对所获取的哈希键值进行哈希计算,得到第一哈希值。第一哈希值用于判断哈希键值对应的哈希表项是否存储在根表中。In an actual implementation, after obtaining the hash key value, the method further includes: performing hash calculation on the obtained hash key value according to the hash function corresponding to the root table, to obtain a first hash value. The first hash value is used to determine whether the hash table corresponding to the hash key value is stored in the root table.
这里,根表中对应的哈希函数可以是:p=f(k),其中,k为哈希键值,p对应着哈希表项的存储地址p,f即为k和p之间建立的哈希函数。f可以为除留余数法kmodA(A≤m)、随机数法random(k)等。Here, the corresponding hash function in the root table may be: p=f(k), where k is a hash key value, p corresponds to the storage address p of the hash table entry, and f is established between k and p. The hash function. f can be a remainder remainder method kmodA (A ≤ m), a random number method random (k), and the like.
本步骤中,将所述待存储的哈希表项存储至根表中,包括:根表中存在第一哈希值对应的哈希表项,在所述根表中根据第一哈希值读取哈希表 项,在所获取的哈希键值与根表中读取出的哈希表项中的哈希键值匹配时,将所述根表中第一哈希值对应的哈希表项更新为待存储的哈希表项;在所获取的哈希键值与根表中读取出的哈希表项中的哈希键值不匹配,且所述根表中还存在哈希表项的存储位置时,在所述根表中插入待存储的哈希表项。In this step, the hash table entry to be stored is stored in the root table, and the hash table corresponding to the first hash value exists in the root table, and the first hash value is used in the root table. Read hash table And updating, when the obtained hash key value matches the hash key value in the hash table item read in the root table, the hash table item corresponding to the first hash value in the root table is updated to The hash table entry to be stored; the obtained hash key value does not match the hash key value in the hash table entry read in the root table, and the hash table entry still exists in the root table. When the location is stored, a hash table entry to be stored is inserted in the root table.
当根表中不存在第一哈希值对应的哈希表项时,在所述根表中插入待存储的哈希表项。When the hash table corresponding to the first hash value does not exist in the root table, the hash table to be stored is inserted into the root table.
在实际实施时,在使用链表存储发生哈希冲突的哈希键值对应的哈希表项之前,还包括:建立链表。In the actual implementation, before using the linked list to store the hash table corresponding to the hash key value of the hash conflict, the method further includes: establishing the linked list.
这里,在读取的存储数据中不包括链表信息项,且所获取的哈希键值与根表中读取出的哈希表项中的哈希键值不匹配,且所述根表中不存在哈希表项的存储位置时,建立链表,在建立的链表中插入待存储的哈希表项。Here, the linked list information item is not included in the read storage data, and the obtained hash key value does not match the hash key value in the hash table entry read in the root table, and the root table is in the root table. When there is no storage location of the hash table entry, a linked list is created, and the hash table to be stored is inserted in the established linked list.
在所述链表中插入待存储的哈希表项后,还包括:基于链表中插入的哈希表项,在所述根表中更新链表信息项。After the hash table item to be stored is inserted in the linked list, the method further includes: updating the linked list information item in the root table based on the hash table item inserted in the linked list.
本步骤中,所述链表信息项还用于指示链表中存在的哈希表项的地址信息;In this step, the linked list information item is further used to indicate address information of a hash entry existing in the linked list;
优选地,将待存储的哈希表项存储至链表中可以包括:根据所述链表对应的哈希函数,对所获取的哈希键值进行哈希计算,得到第二哈希值;将所述链表信息项中与获取的哈希键值对应的哈希表项的地址信息记为第三哈希值。Preferably, storing the hash table item to be stored in the linked list may include: performing hash calculation on the obtained hash key value according to the hash function corresponding to the linked list, to obtain a second hash value; The address information of the hash table entry corresponding to the obtained hash key value in the linked list information item is recorded as the third hash value.
需要说明的是,链表对应的哈希函数是不同于根表哈希函数的另一种哈希函数。第二哈希值和第三哈希值都是哈希键值通过链表对应的哈希函数计算后得到的。It should be noted that the hash function corresponding to the linked list is another hash function different from the root table hash function. The second hash value and the third hash value are both obtained by calculating a hash key value through a hash function corresponding to the linked list.
在所述第三哈希值与第二哈希值相同时,在所述链表中根据第二哈希值读取哈希表项,在所获取的哈希键值与链表中读取出的哈希表项中的哈 希键值匹配时,将所述链表中第二哈希值对应的哈希表项更新为待存储的哈希表项;在所获取的哈希键值与读取出的哈希表项中的哈希键值不匹配时,在所述链表中插入待存储的哈希表项。When the third hash value is the same as the second hash value, the hash table entry is read according to the second hash value in the linked list, and the obtained hash key value and the linked list are read out. Haha in the hash table entry When the hash key value is matched, the hash table corresponding to the second hash value in the linked list is updated to the hash table to be stored; in the obtained hash key value and the read hash table entry When the hash key values do not match, the hash table entry to be stored is inserted in the linked list.
在所述第三哈希值与第二哈希值不相同时,在所述链表中插入待存储的哈希表项。When the third hash value is different from the second hash value, a hash table entry to be stored is inserted in the linked list.
在所述链表中插入待存储的哈希表项后,还包括:基于插入的哈希表项更新链表信息项。After the hash table item to be stored is inserted in the linked list, the method further includes: updating the linked list information item based on the inserted hash table item.
优选的,在对待存储的哈希表项进行存储时,还包括:预先设置第一存储空间和第二存储空间,所述第二存储空间的容量大于第一存储空间的容量;将所述根表中的哈希表项存储于第一存储空间或第二存储空间,将所述链表中的哈希表项存储于第二存储空间。Preferably, when storing the hash table to be stored, the method further includes: presetting a first storage space and a second storage space, where the capacity of the second storage space is greater than a capacity of the first storage space; The hash table entries in the table are stored in the first storage space or the second storage space, and the hash table entries in the linked list are stored in the second storage space.
这里,第二存储空间可以是任意大小的,因此将大容量的哈希表项或者产生哈希冲突的哈希表项存储到第二存储空间中,实现了对哈希表项的存储位置进行灵活的管理,提高了哈希冲突的容纳数量。Here, the second storage space may be of any size, so that a large-capacity hash table entry or a hash table entry that generates a hash conflict is stored in the second storage space, and the storage location of the hash table entry is implemented. Flexible management increases the number of hash collisions.
需要说明的是,哈希表项在根表中存储时如果产生了哈希冲突,需要将冲突的哈希表项存入到链表中,此时的链表信息项可以按照图3所示的格式存储到根表中哈希冲突所在的存储单元中,这样当对存在哈希冲突的哈希表项进行查找时,可以将链表信息项返回,从而进一步的查找链表中保存的冲突哈希表项。It should be noted that if a hash conflict occurs when the hash table entry is stored in the root table, the conflicted hash table entry needs to be stored in the linked list, and the linked list information item may be in the format shown in FIG. Stored in the storage unit where the hash conflict exists in the root table, so that when the hash table item with the hash conflict is searched, the linked list information item can be returned, thereby further searching for the conflict hash table item saved in the linked list. .
在实际实施时,在将待存储的哈希表项存储完毕后,还可以包括根据输入键值查找对应的哈希表项。In actual implementation, after the hash table item to be stored is stored, the method may further include searching for a corresponding hash table entry according to the input key value.
可选的,查找哈希表项的方法可以包括:Optionally, the method for finding a hash entry may include:
获取用于进行哈希查找的查找键值;Get the lookup key value used to perform the hash lookup;
根据查找键值在根表中进行哈希表项查找,得到哈希表项查找结果;The hash table entry is searched in the root table according to the search key value, and the hash table entry search result is obtained;
在哈希表项查找结果指示链表中不存在所述查找键值对应的哈希表项 时,在所述哈希表项查找结果中确定根表中与所述查找键值对应的哈希表项;The hash table entry corresponding to the lookup key value does not exist in the hash table entry search result indicating list. Determining, in the hash table entry search result, a hash table entry corresponding to the lookup key value in the root table;
在哈希表项查找结果指示链表中存在所述查找键值对应的哈希表项时,根据查找键值在链表中进行哈希表项查找,得到链表中与所述查找键值对应的哈希表项。When the hash table item corresponding to the search key value exists in the hash table item search result indication link table, the hash table item search is performed in the linked list according to the search key value, and the hash table corresponding to the search key value is obtained. Histology item.
本发明实施例中,使用链表存储发生哈希冲突的哈希键值对应的哈希表项,使用根表存储各个哈希键值对应的哈希表项、以及链表信息项,所述链表信息项用于指示链表中是否存在每个哈希键值对应的哈希表项;获取哈希键值以及待存储的哈希表项;依据所获取的哈希键值读取根表中的存储数据;在读取的存储数据中不包括链表信息项时,将所述待存储的哈希表项存储至根表中;在读取的存储数据中包括链表信息项时,将所述待存储的哈希表项存储至链表中。如此,提高了哈希冲突容纳的数量。In the embodiment of the present invention, a linked list is used to store a hash table entry corresponding to a hash key value in which a hash conflict occurs, and a root table is used to store a hash table entry corresponding to each hash key value and a linked list information item, where the linked list information is used. The item is used to indicate whether there is a hash table entry corresponding to each hash key value in the linked list; obtaining a hash key value and a hash table item to be stored; and reading the storage in the root table according to the obtained hash key value Data; storing the hash table item to be stored in the root table when the stored data is not included in the stored data; and storing the stored information in the stored data includes the linked list information item The hash table entries are stored in the linked list. In this way, the number of hash collisions is increased.
第二实施例Second embodiment
为了能更加体现本发明的目的,在本发明第一实施例的基础上,进行进一步的举例说明。In order to further embodies the object of the present invention, further exemplification will be made on the basis of the first embodiment of the present invention.
图4为本发明哈希表管理的方法的第二实施例的流程图,该方法包括:4 is a flowchart of a second embodiment of a method for managing a hash table according to the present invention, the method includes:
步骤40:输入待存储的哈希表项信息。Step 40: Enter the hash entry information to be stored.
这里,待存储的哈希表项信息可以包括:待存储的哈希表项、待存储的哈希表项对应的键值、键值类型和大小等信息。Here, the hash entry information to be stored may include: a hash table to be stored, a key value corresponding to the hash table to be stored, a key type and size, and the like.
步骤41:根据哈希表项信息得到的存储地址访问根表读取存储数据。Step 41: The storage address obtained according to the hash table entry information accesses the root table to read the stored data.
本步骤中,先对哈希表项信息中的键值使用第一哈希函数进行运算得到第一哈希值,这里的第一哈希值可以是对应的哈希表项在根表中的存储地址,也可以是一个偏移地址,加上基地址后得到最终的存储地址。通过得到的存储地址访问根表中的存储数据。In this step, the first hash value is obtained by using the first hash function to calculate the key value in the hash table item information, where the first hash value may be the corresponding hash table item in the root table. The storage address can also be an offset address, plus the base address to get the final storage address. The stored data in the root table is accessed through the obtained storage address.
这里,获得的存储数据可以是:根表中存储的哈希表项信息,或者根 表中的链表信息项。当根据待存储的哈希表项对应的键值可以在根表中找到相同键值的哈希表项时,直接获得该哈希表项,当找不到相同键值的哈希表项时,获得链表信息项。Here, the obtained storage data may be: hash table item information stored in the root table, or root The linked list information item in the table. When the hash table entry of the same key value can be found in the root table according to the key value corresponding to the hash table to be stored, the hash table entry is directly obtained, and when the hash table entry of the same key value is not found, , get the linked list information item.
需要说明的是,访问存储地址中的数据的目的是,判断当前输入的待存储的哈希表项信息是用于更新根表或链表中已有的表项信息,还是作为新的哈希表项信息插入到根表或链表中。It should be noted that the purpose of accessing the data in the storage address is to determine whether the currently input hash table item information is used to update the existing item information in the root table or the linked list, or as a new hash table. The item information is inserted into the root or linked list.
步骤42:判断获得的数据是否为链表信息项,如果是,执行步骤43;如果否,执行步骤44。Step 42: Determine whether the obtained data is a linked list information item. If yes, go to step 43; if no, go to step 44.
本步骤中,判断获得的数据是否为链表信息项的目的是:判断将输入的存储信息存入到根表中还是链表中。In this step, the purpose of determining whether the obtained data is a linked list information item is: determining whether the input storage information is stored in the root table or in the linked list.
优选的,可通过判断读取的数据中是否存在链表信息项表示标识,来确定获得的数据是否为链表信息项。Preferably, whether the obtained data is a linked list information item can be determined by determining whether there is a linked list information item representation identifier in the read data.
步骤43:获得键值对应的第二哈希值,判断链表信息项中是否存储与第二哈希值相等的第三哈希值,如果是,执行步骤431;如果否,执行步骤432。Step 43: Obtain a second hash value corresponding to the key value, determine whether a third hash value equal to the second hash value is stored in the linked list information item, and if yes, execute step 431; if no, execute step 432.
本步骤中,对存储信息中的键值使用第二哈希函数进行运算得到第二哈希值,将第二哈希值与链表信息项中的链表对比信息中存储的所有的第三哈希值比较,当存在与第二哈希值相等的第三哈希值时,说明此时的存储信息是用来更新链表中的哈希表项的;当不存在与第二哈希值相等的第三哈希值时,说明此时的存储信息是作为新的哈希表项插入到链表中的。In this step, the second hash function is used to calculate the key value in the stored information to obtain the second hash value, and the second hash value is compared with all the third hashes stored in the linked list comparison information in the linked list information item. Value comparison, when there is a third hash value equal to the second hash value, indicating that the storage information at this time is used to update the hash table entry in the linked list; when there is no equal value to the second hash value The third hash value indicates that the storage information at this time is inserted into the linked list as a new hash table entry.
步骤431:根据链表中与第二哈希值对应的表项信息,判断哈希表项对应的键值是否与输入键值相等,如果是,执行步骤45;如果否,执行步骤432。Step 431: Determine, according to the entry information corresponding to the second hash value in the linked list, whether the key value corresponding to the hash entry is equal to the input key value. If yes, go to step 45; if no, go to step 432.
步骤432:判断链表是否存满,如果是,执行步骤46;如果否,执行步骤433。 Step 432: Determine whether the linked list is full. If yes, go to step 46; if no, go to step 433.
步骤433:将待存储哈希表项信息插入到链表中,并更新根表中的链表信息项。Step 433: Insert the information of the hash table item to be stored into the linked list, and update the linked list information item in the root table.
本步骤中,在将存储信息是作为新的哈希表项插入到链表中后,需要将存储信息中的键值对应的第二哈希值存入到链表信息项的链表比对信息中,同时更新链表地址信息,为该第二哈希值对应的哈希表项分配存储地址。In this step, after the stored information is inserted into the linked list as a new hash table entry, the second hash value corresponding to the key value in the stored information needs to be stored in the linked list comparison information of the linked list information item. The linked list address information is updated at the same time, and the storage address is allocated for the hash table corresponding to the second hash value.
可以理解的是,在本步骤执行完毕后当前存储信息已经成功的保存到链表中,哈希表项管理结束,执行步骤47。It can be understood that, after the execution of this step is completed, the current storage information has been successfully saved in the linked list, and the hash table entry management ends, and step 47 is performed.
步骤44:判断从根表中读取的哈希表项是否有效,如果是,执行步骤442;如果否,执行步骤441。Step 44: Determine whether the hash table entry read from the root table is valid. If yes, go to step 442; if no, go to step 441.
本步骤中,判断哈希表项是否有效的方法可以是:通过判断读取的存储数据中,哈希表项头信息中的哈希表项有效标识位是否为1,如果是,表示当前读取的哈希表项有效;如果否,表示读取的数据中不包括任何哈希表项。此时需要将待存储信息插入到根表中。In this step, the method for determining whether the hash entry is valid may be: determining whether the valid identifier of the hash entry in the header information of the hash table entry is 1 by using the stored data, and if yes, indicating that the current read is The hashed entry is valid; if not, it means that no data is included in the read data. In this case, you need to insert the information to be stored into the root table.
步骤441:将待存储的哈希表项信息插入到根表中后,执行步骤47。Step 441: After the hash table item information to be stored is inserted into the root table, step 47 is performed.
步骤442:判断哈希表项对应的键值是否与输入键值相等,如果是,执行步骤45;如果否,执行步骤443。Step 442: Determine whether the key value corresponding to the hash entry is equal to the input key value. If yes, go to step 45; if no, go to step 443.
步骤443:判断根表是否存满,如果是,执行步骤444;如果否,执行步骤441。Step 443: Determine whether the root table is full. If yes, go to step 444; if no, go to step 441.
步骤444:申请建立链表,用于存储输入信息,并判断是否申请成功,如果是,执行步骤445;如果否,执行步骤46。Step 444: Apply to establish a linked list for storing input information, and determine whether the application is successful. If yes, go to step 445; if no, go to step 46.
步骤445:将输入信息存储到链表中,并更新根表中的链表信息项,执行步骤47。Step 445: The input information is stored in the linked list, and the linked list information item in the root table is updated, and step 47 is performed.
步骤45:利用输入的哈希表项信息更新表中对应的哈希表项信息。Step 45: Update the corresponding hash table item information in the table by using the input hash table item information.
这里,在确定输入的键值及对应的哈希表项在当前根表或者链表中已 经存在时,说明当前输入的信息是用来更新根表或者链表中对应的信息,在执行完更新操作后,执行步骤47。Here, in determining the input key value and the corresponding hash table item in the current root table or linked list When present, it indicates that the currently input information is used to update the corresponding information in the root table or the linked list. After the update operation is performed, step 47 is performed.
步骤46:存储失败。Step 46: The storage fails.
步骤47:存储结束。Step 47: The storage ends.
根据上述表项管理方法可以看出,待存储的哈希表项信息对根表的更新和插入过程相同;待存储的哈希表项信息插入到链表时,需要对根表中链表信息项进行更新,而更新链表时,只需要替换对应的哈希表项信息不需要更新链表信息项。According to the foregoing table entry management method, the hash table entry information to be stored is the same as the root table update and insertion process. When the hash table entry information to be stored is inserted into the linked list, the linked list information item in the root table needs to be performed. Update, and when updating the linked list, only need to replace the corresponding hash table item information does not need to update the linked list information item.
在实际实施时,当需要查询哈希表项信息时,用户只需要输入查询信息,这里的查询信息包括:待查询的哈希表项对应的键值、键值类型和大小等信息。需要说明的是,查询流程和存储流程在数据的读取和键值的比较的过程是相同的,只是删除了哈希表项的插入或者更新的步骤。In actual implementation, when the information of the hash table item needs to be queried, the user only needs to input the query information, where the query information includes: the key value, the key type and the size of the hash table item to be queried. It should be noted that the query process and the storage process are the same in the process of reading the data and comparing the key values, but deleting the steps of inserting or updating the hash table entries.
第三实施例Third embodiment
针对本发明实施例的方法,本发明实施例还提供了一种哈希表管理的装置,图5为本发明实施例哈希表管理的装置的第一组成结构示意图,如图5所示,该装置包括:链表和根表;其中,For the method of the embodiment of the present invention, the embodiment of the present invention further provides a device for managing a hash table, and FIG. 5 is a schematic diagram of a first component structure of the device for managing a hash table according to an embodiment of the present invention, as shown in FIG. The device includes: a linked list and a root table; wherein
链表,配置为存储发生哈希冲突的哈希键值对应的哈希表项;a linked list configured to store a hash table entry corresponding to a hash key value in which a hash conflict occurs;
根表,配置为存储链表信息项和各个哈希键值对应的哈希表项,所述链表信息项用于指示链表中是否存在每个哈希键值对应的哈希表项;The root table is configured to store a linked list information item and a hash table entry corresponding to each hash key value, where the linked list information item is used to indicate whether a hash table entry corresponding to each hash key value exists in the linked list;
所述装置还包括:获取模块50和处理模块51;其中,The device further includes: an obtaining module 50 and a processing module 51; wherein
获取模块50,配置为获取哈希键值以及待存储的哈希表项。The obtaining module 50 is configured to obtain a hash key value and a hash table item to be stored.
处理模块51,配置为依据所获取的哈希键值读取根表中的存储数据;在读取的存储数据中不包括链表信息项时,将所述待存储的哈希表项存储至根表中;在读取的存储数据中包括链表信息项时,将所述待存储的哈希表项存储至链表中。 The processing module 51 is configured to: read the stored data in the root table according to the obtained hash key value; and store the hash table item to be stored to the root when the stored storage data does not include the linked list information item In the table, when the linked data item is included in the read storage data, the hash table item to be stored is stored in the linked list.
优选地,所述处理模块51,还配置为根据所述根表对应的哈希函数,对所获取的哈希键值进行哈希计算,得到第一哈希值;Preferably, the processing module 51 is further configured to perform a hash calculation on the obtained hash key value according to a hash function corresponding to the root table, to obtain a first hash value;
相应地,所述处理模块51,还配置为在所述根表中存在第一哈希值对应的哈希表项,在所述根表中根据第一哈希值读取哈希表项,在所获取的哈希键值与根表中读取出的哈希表项中的哈希键值匹配时,将所述根表中第一哈希值对应的哈希表项更新为待存储的哈希表项;在所获取的哈希键值与根表中读取出的哈希表项中的哈希键值不匹配,且所述根表中还存在哈希表项的存储位置时,在所述根表中插入待存储的哈希表项;在所述根表中不存在第一哈希值对应的哈希表项时,在所述根表中插入待存储的哈希表项。Correspondingly, the processing module 51 is further configured to: in the root table, a hash table entry corresponding to the first hash value, where the hash table entry is read according to the first hash value, When the obtained hash key value matches the hash key value in the hash table entry read in the root table, the hash table corresponding to the first hash value in the root table is updated to be stored. Hash table entry; the obtained hash key value does not match the hash key value in the hash table entry read in the root table, and the storage location of the hash table entry still exists in the root table Inserting a hash table entry to be stored in the root table; when there is no hash table entry corresponding to the first hash value in the root table, inserting a hash to be stored in the root table Entry.
优选地,所述处理模块51,还配置为在读取的存储数据中不包括链表信息项,且所获取的哈希键值与根表中读取出的哈希表项中的哈希键值不匹配,且所述根表中不存在哈希表项的存储位置时,建立链表,在建立的链表中插入待存储的哈希表项。Preferably, the processing module 51 is further configured to not include the linked list information item in the read storage data, and the obtained hash key value and the hash key in the hash table item read in the root table If the value does not match, and the storage location of the hash table entry does not exist in the root table, the linked list is created, and the hash table to be stored is inserted in the established linked list.
优选地,所述处理模块51,还配置为在所述链表中插入待存储的哈希表项后,基于链表中插入的哈希表项,在所述根表中更新链表信息项。Preferably, the processing module 51 is further configured to: after inserting the hash table item to be stored in the linked list, update the linked list information item in the root table based on the hash table item inserted in the linked list.
优选地,所述链表信息项还用于指示链表中存在的哈希表项的地址信息;Preferably, the linked list information item is further used to indicate address information of a hash entry existing in the linked list;
所述处理模块51,还配置为根据所述链表对应的哈希函数,对所获取的哈希键值进行哈希计算,得到第二哈希值;将所述链表信息项中与获取的哈希键值对应的哈希表项的地址信息记为第三哈希值;The processing module 51 is further configured to perform hash calculation on the obtained hash key value according to the hash function corresponding to the linked list, to obtain a second hash value, and obtain the hash information information item and the obtained hash value. The address information of the hash table corresponding to the hash key value is recorded as a third hash value;
所述处理模块51,还配置为在所述第三哈希值与第二哈希值相同时,在所述链表中根据第二哈希值读取哈希表项,在所获取的哈希键值与链表中读取出的哈希表项中的哈希键值匹配时,将所述链表中第二哈希值对应的哈希表项更新为待存储的哈希表项;在所获取的哈希键值与读取出的哈 希表项中的哈希键值不匹配时,在所述链表中插入待存储的哈希表项;在所述第三哈希值与第二哈希值不相同时,在所述链表中插入待存储的哈希表项。The processing module 51 is further configured to: when the third hash value and the second hash value are the same, read the hash table entry according to the second hash value in the linked list, and obtain the hash When the key value matches the hash key value in the hash table entry read in the linked list, the hash table corresponding to the second hash value in the linked list is updated to the hash table to be stored; Get the hash key value and read it out When the hash key value in the hash table item does not match, the hash table item to be stored is inserted in the linked list; when the third hash value is different from the second hash value, in the linked list Insert the hash table entry to be stored.
优选地,所述处理模块51,还配置为在所述链表中插入待存储的哈希表项后,基于插入的哈希表项更新链表信息项。Preferably, the processing module 51 is further configured to: after inserting the hash table item to be stored in the linked list, update the linked list information item based on the inserted hash table item.
优选地,所述装置还包括:查找模块;Preferably, the device further includes: a lookup module;
所述查找模块,还配置为获取用于进行哈希查找的查找键值;根据查找键值在根表中进行哈希表项查找,得到哈希表项查找结果;在哈希表项查找结果指示根表中存在所述查找键值对应的哈希表项时,在所述哈希表项查找结果中确定根表中与所述查找键值对应的哈希表项;在哈希表项查找结果指示根表中不存在所述查找键值对应的哈希表项时,根据查找键值在链表中进行哈希表项查找,得到链表中与所述查找键值对应的哈希表项。The search module is further configured to obtain a lookup key value for performing a hash search; perform a hash table item search in the root table according to the search key value, and obtain a hash table item search result; and search results in the hash table item. When the hash table entry corresponding to the search key value exists in the root table, the hash table entry corresponding to the search key value in the root table is determined in the hash table entry search result; in the hash table entry If the search result indicates that the hash table corresponding to the search key value does not exist in the root table, the hash table entry is searched in the linked list according to the search key value, and the hash table corresponding to the search key value in the linked list is obtained. .
优选地,所述装置还包括:第一存储空间和第二存储空间,所述第二存储空间的容量大于第一存储空间的容量;Preferably, the device further includes: a first storage space and a second storage space, wherein the capacity of the second storage space is greater than the capacity of the first storage space;
所述根表中的哈希表项的存储位置为第一存储空间或第二存储空间,所述链表中的哈希表项的存储位置为第二存储空间。The storage location of the hash table entry in the root table is the first storage space or the second storage space, and the storage location of the hash table entry in the linked list is the second storage space.
在实际实施时,第一存储空间可以是装置内部的片内存储单元,第二存储空间可以时装置外部的片外存储单元,片外存储单元的存储空间远大与片内存储单元的,可以将全部或部分的根表,以及全部的链表存入到片外存储单元,提高装置的工作效率。In actual implementation, the first storage space may be an on-chip storage unit inside the device, the second storage space may be an off-chip storage unit outside the device, and the storage space of the off-chip storage unit is large and the on-chip storage unit may be All or part of the root table, and all the linked lists are stored in the off-chip storage unit, improving the working efficiency of the device.
在实际应用中,获取模块50和处理模块51均可由位于终端设备中的中央处理器(Central Processing Unit,CPU)、微处理器(Micro Processor Unit,MPU)、数字信号处理器(Digital Signal Processor,DSP)、或现场可编程门阵列(Field Programmable Gate Array,FPGA)等实现。In an actual application, the obtaining module 50 and the processing module 51 may each be a Central Processing Unit (CPU), a Micro Processor Unit (MPU), and a Digital Signal Processor (Digital Signal Processor) located in the terminal device. DSP), or Field Programmable Gate Array (FPGA) implementation.
第四实施例 Fourth embodiment
图6为本发明实施例哈希表管理的装置的第二组成结构示意图,该装置可以包括:用户接口101、根表查找模块102、链表查找模块103、查找请求调度模块104、外部存储管理模块105、外部存储模块106、查找返回调度模块107、软件表项管理模块108和内部存储模块109。FIG. 6 is a schematic diagram of a second component structure of an apparatus for managing a hash table according to an embodiment of the present invention. The apparatus may include: a user interface 101, a root table lookup module 102, a linked list lookup module 103, a lookup request scheduling module 104, and an external storage management module. 105. An external storage module 106, a lookup return scheduling module 107, a software entry management module 108, and an internal storage module 109.
其中,用户接口101、根表查找模块102、链表查找模块103、查找请求调度模块104、外部存储管理模块105和查找返回调度模块107用于对哈希表项的查找管理。The user interface 101, the root table lookup module 102, the linked list lookup module 103, the lookup request scheduling module 104, the external storage management module 105, and the lookup return scheduling module 107 are used for lookup management of the hash table entries.
软件表项管理模块108,对哈希表项的存储管理。The software entry management module 108 manages the storage of the hash entries.
外部存储模块106和内部存储模块109,配置为实现哈希表项的灵活存储。The external storage module 106 and the internal storage module 109 are configured to implement flexible storage of hash entries.
其中,本发明实施例提供的哈希表项管理装置,在进行哈希表项查找时各模块的具体操作过程如下:The specific operation process of each module in the hash table item management apparatus provided by the embodiment of the present invention is as follows:
图7为本发明实施例中根表查找模块内部结构示意图,如图7所示,根表查找模块包括:根表缓存单元201、根表解析单元202和根表处理单元203。根表查找模块102接收用户接口101传递来的查找信息,查找信息包括:键值、键值类型和大小等;将查找信息放入根表缓存单元201中,并将键值发送到装置的内部存储模块109中,内部存储模块109根据键值计算出第一哈希值,并第一哈希值对应的返回数据发送给根表处理单元203;同时根表解析单元202根据键值也计算出第一哈希值,生成查找请求发送给查找请求调度模块104,查找请求可以包括:全部的查找信息、指示查找外部存储模块106的触发信号等。查找请求调度模块104请求从外部存储模块查找对应的哈希表项,将获得第一哈希值对应的返回数据发送给根表处理单元203;根表处理单元203从缓存单元201中读出查找信息并与获得的返回数据进行匹配,如果匹配,说明返回数据中包含键值对应的哈希表项,则直接将返回数据发送至查找返回调度模块107,返回数据的结构如图 2所示;如果不匹配,说明返回数据中不包含键值对应的哈希表项,需要进行链表查找,此时向链表查找模块103发起查找请求,返回数据中的链表信息项的结构如图3所示。FIG. 7 is a schematic diagram of an internal structure of a root table lookup module according to an embodiment of the present invention. As shown in FIG. 7, the root table lookup module includes: a root table cache unit 201, a root table parsing unit 202, and a root table processing unit 203. The root table lookup module 102 receives the lookup information transmitted by the user interface 101, and the search information includes: a key value, a key type and a size, etc.; the lookup information is placed in the root table cache unit 201, and the key value is sent to the inside of the device. In the storage module 109, the internal storage module 109 calculates a first hash value according to the key value, and the return data corresponding to the first hash value is sent to the root table processing unit 203; and the root table parsing unit 202 also calculates the key value according to the key value. The first hash value is generated and sent to the lookup request scheduling module 104. The lookup request may include: all the search information, a trigger signal indicating the search for the external storage module 106, and the like. The lookup request scheduling module 104 requests the external storage module to search for the corresponding hash table entry, and sends the return data corresponding to the first hash value to the root table processing unit 203; the root table processing unit 203 reads the lookup from the cache unit 201. The information is matched with the obtained return data. If it matches, indicating that the returned data contains the hash table corresponding to the key value, the return data is directly sent to the lookup return scheduling module 107, and the structure of the returned data is as shown in the figure. 2; if it does not match, it means that the returned data does not contain the hash table corresponding to the key value, and needs to perform the linked list lookup. At this time, the lookup request is initiated to the linked list lookup module 103, and the structure of the linked list information item in the returned data is as shown in FIG. 3 is shown.
这里,当根表查找模块未获得待查找的哈希表项,而获得的是链表信息项,此时通过解析链表信息项自动进行链表查找,可以提高表项的查找效率。Here, when the root table lookup module does not obtain the hash table item to be searched, and obtains the linked list information item, the list lookup is automatically performed by parsing the linked list information item, thereby improving the search efficiency of the entry.
可选的,根表处理单元203从根表缓存单元201中读出查找信息并与获得的返回数据进行匹配,包括:将查找信息中的键值、键值类型和大小等与返回数据中哈希表项对应的键值、键值类型和大小等信息进行一一比较,当所有的信息均相同时,确定数据匹配,返回的数据中包含要查找的哈希表项;如果至少有一项不相同,确定数据不匹配,返回的数据中不包含要查找的哈希表项。Optionally, the root table processing unit 203 reads the lookup information from the root table cache unit 201 and matches the obtained return data, including: the key value, the key type and the size in the search information, and the returned data. The information such as the key value, the key type, and the size of the hash table item are compared one by one. When all the information is the same, it is determined that the data matches, and the returned data includes the hash table item to be searched; if at least one item is not The same, to determine the data does not match, the returned data does not contain the hash table item to be found.
图8为本发明实施例中链表查找模块内部结构示意图,如图8所示,链表查找模块包括:链表缓存单元301、链表解析单元302和链表处理单元303。根表查找模块102向链表查找模块103发起查找请求后,查找请求被存入到链表缓存单元301和链表解析单元302,链表解析单元302对查找请求解析后发往查找请求调度模块104,查找请求调度模块104向外部存储管理模块105申请相应的查询操作,外部存储管理模块105完成对外部存储模块106的查询并将查询结果返回到链表处理单元303;链表处理单元303从链表缓存单元301中读出查找请求中包含的查找信息并与获得的查询结果进行对比,将对比结果发送至查找返回调度模块107。这里,在链表中查找到与键值对应的哈希表项时,将获得的哈希表项返回;在链表中未查找到与键值对应的哈希表项时,可以返回提示信息表示未查找到对应哈希表项。FIG. 8 is a schematic diagram of an internal structure of a linked list lookup module according to an embodiment of the present invention. As shown in FIG. 8, the linked list lookup module includes: a linked list cache unit 301, a linked list parsing unit 302, and a linked list processing unit 303. After the root table lookup module 102 initiates the lookup request to the linked list lookup module 103, the lookup request is stored in the linked list cache unit 301 and the linked list parsing unit 302. The linked list parsing unit 302 parses the lookup request and sends it to the lookup request scheduling module 104 for a lookup request. The scheduling module 104 applies to the external storage management module 105 for a corresponding query operation, and the external storage management module 105 completes the query to the external storage module 106 and returns the query result to the linked list processing unit 303; the linked list processing unit 303 reads from the linked list cache unit 301. The lookup information contained in the lookup request is compared and compared with the obtained query result, and the comparison result is sent to the lookup return scheduling module 107. Here, when the hash table corresponding to the key value is found in the linked list, the obtained hash table entry is returned; when the hash table corresponding to the key value is not found in the linked list, the prompt information may be returned Find the corresponding hash table entry.
图9为本发明实施例中查找请求调度模块内部结构示意图,如图9所 示,查找请求调度模块104包括:根表查找缓存单元401、链表查找缓存单元402和查找请求调度单元403。根表查找缓存单元401和链表查找缓存单元402分别缓存根表解析单元202和链表解析单元302产生的查找请求。查找请求调度单元403在读取两个缓存单元中的查找请求后,为查找请求加上查找类型标志再发送到外部存储管理模块105。这里,查找类型标识可以标识当前需要查找的是根表内容还是链表内容,可选的,可以通过设置一个查找类型标志位来区分当前查找对象,当查找类型标志位为1时,表明查找对象为根表中的表项信息;当查找类型标志位为0时,表明查找对象为链表中的表项信息。通过设置查找类型标识可以提高哈希表项的查找效率。FIG. 9 is a schematic diagram of an internal structure of a lookup request scheduling module according to an embodiment of the present invention, as shown in FIG. The lookup request scheduling module 104 includes a root table lookup cache unit 401, a linked list lookup cache unit 402, and a lookup request scheduling unit 403. The root table lookup cache unit 401 and the linked list lookup cache unit 402 cache the lookup requests generated by the root table parsing unit 202 and the linked list parsing unit 302, respectively. The lookup request scheduling unit 403, after reading the lookup request in the two cache units, adds a lookup type flag to the lookup request and sends it to the external storage management module 105. Here, the search type identifier can identify whether the current table content or the linked list content needs to be searched. Optionally, a search type flag bit can be set to distinguish the current search object. When the search type flag bit is 1, the search object is The entry information in the root table; when the lookup type flag is 0, it indicates that the search object is the entry information in the linked list. You can improve the efficiency of finding hash entries by setting the lookup type identifier.
图10为本发明实施例中查找返回调度模块内部结构示意图,如图10所示,查找返回调度模块107包括:根表查找结果缓存单元701、链表查找结果缓存单元702和查找返回调度单元703。根表查找结果缓存单元701和链表查找结果缓存单元702分别缓存根表处理单元303和链表处理单元403产生的查找返回结果,查找返回调度单元703读取两个缓存单元中的查找结果,并将其通过用户接口101返回给用户。10 is a schematic diagram of an internal structure of a lookup return scheduling module according to an embodiment of the present invention. As shown in FIG. 10, the lookup return scheduling module 107 includes a root table lookup result buffering unit 701, a linked list lookup result buffering unit 702, and a lookup returning scheduling unit 703. The root table search result buffer unit 701 and the linked list search result buffer unit 702 respectively cache the lookup return results generated by the root table processing unit 303 and the linked list processing unit 403, and the lookup return scheduling unit 703 reads the search results in the two cache units, and It is returned to the user via the user interface 101.
本发明实施例提供的哈希表项管理装置,在进行哈希表项存储时各模块的具体操作过程如下:The specific operation process of each module in the hash table item management apparatus provided by the embodiment of the present invention is as follows:
图11为本发明实施例中软件表项管理模块内部结构示意图,如图11所示,软件表项管理模块108可以包括:主设备801、软件管理单元802、软件缓存单元803。FIG. 11 is a schematic diagram of an internal structure of a software entry management module according to an embodiment of the present invention. As shown in FIG. 11, the software entry management module 108 may include: a master device 801, a software management unit 802, and a software cache unit 803.
主设备801在对哈希表项进行存储时,先通过软件管理单元802判断将哈希表项存储到根表还是链表中,当确定了哈希表项存储的存储位置后,软件管理单元802将哈希表项先缓存到软件缓存单元803中,软件缓存再通过外设部件互连标准总线(Peripheral Component Interconnect Express, PCIE)接口写入到外部存储模块106中。需要说明的是,为了减少装置内部存储模块占用率提高装置运行效率,可以将根表和链表都存储到外部存储模块;也可以将根表中较小的哈希表项存储到内部存储模块中,将较大的哈希表项存储在外部存储模块中。When storing the hash table entry, the master device 801 first determines whether the hash table entry is stored in the root table or the linked list by the software management unit 802. After determining the storage location of the hash table entry storage, the software management unit 802 The hash table entry is first cached into the software cache unit 803, and the software cache is interconnected by a peripheral component (Peripheral Component Interconnect Express, The PCIE) interface is written to the external storage module 106. It should be noted that, in order to reduce the operation efficiency of the internal storage module of the device, the root table and the linked list may be stored in the external storage module; or the smaller hash entries in the root table may be stored in the internal storage module. , store the large hash table entries in the external storage module.
这里,哈希表项管理装置在进行哈希表项查找时,可以采用流水线的方法,对于同一级表项,即同属根表的表项或链表的表项。由于存储位置和查找流程均一致,查找接口可以对同一级查找实现顺序查找。对于不同级的查找,即查找的表项分别处于根表和链表中,查找接口也可以根据获得查找请求的先后顺序进行查找。Here, the hash table entry management device may adopt a pipeline method when performing hash table item search, for an entry of the same level entry, that is, an entry of the same root table or a linked list. Because the storage location and the discovery process are consistent, the lookup interface can perform sequential lookups for the same level of lookup. For different levels of lookup, that is, the searched entries are in the root table and the linked list, and the lookup interface can also be searched according to the order in which the lookup requests are obtained.
本发明实施例在哈希表项查找的过程中,可以同时实现哈希表项的存储管理,如果表项存储的过程中出现错误,则可以将错误标识返回给哈希表项管理装置,再由管理装置对错误情况进行处理,例如,重新存储表项或阻止对错误表项的查找等。In the process of searching for a hash entry, the storage management of the hash entry may be implemented at the same time. If an error occurs in the process of storing the entry, the error identifier may be returned to the hash table item management device, and then The error condition is handled by the management device, for example, re-storing the entry or blocking the lookup of the error entry.
本领域内的技术人员应明白,本发明的实施例可提供为方法、系统、或计算机程序产品。因此,本发明可采用硬件实施例、软件实施例、或结合软件和硬件方面的实施例的形式。而且,本发明可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器和光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art will appreciate that embodiments of the present invention can be provided as a method, system, or computer program product. Accordingly, the present invention can take the form of a hardware embodiment, a software embodiment, or a combination of software and hardware. Moreover, the invention can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) including computer usable program code.
本发明是参照根据本发明实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功 能的装置。The present invention has been described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (system), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or FIG. 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 device to produce a machine for the execution of instructions for execution by a processor of a computer or other programmable data processing device. The work specified in one or more blocks of a flow or a flow and/or a block diagram of a flowchart Able device.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。The computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device. The apparatus implements the functions specified in one or more blocks of a flow or a flow and/or block diagram of the flowchart.
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are performed on a computer or other programmable device to produce computer-implemented processing for execution on a computer or other programmable device. The instructions provide steps for implementing the functions specified in one or more of the flow or in a block or blocks of a flow diagram.
相应地,本发明实施例还提供一种计算机存储介质,其中存储有计算机程序,该计算机程序配置为执行本发明实施例的哈希表管理的方法。Correspondingly, an embodiment of the present invention further provides a computer storage medium, wherein a computer program is configured, and the computer program is configured to perform a hash table management method according to an embodiment of the present invention.
以上所述,仅为本发明的较佳实施例而已,并非用于限定本发明的保护范围。The above is only the preferred embodiment of the present invention and is not intended to limit the scope of the present invention.
工业实用性Industrial applicability
本发明实施例的技术方案,使用链表存储发生哈希冲突的哈希键值对应的哈希表项,使用根表存储各个哈希键值对应的哈希表项、以及链表信息项,所述链表信息项用于指示链表中是否存在每个哈希键值对应的哈希表项;获取哈希键值以及待存储的哈希表项;依据所获取的哈希键值读取根表中的存储数据;在读取的存储数据中不包括链表信息项时,将所述待存储的哈希表项存储至根表中;在读取的存储数据中包括链表信息项时,将所述待存储的哈希表项存储至链表中。如此,提高了哈希冲突容纳的数量。 The technical solution of the embodiment of the present invention uses a linked list to store a hash table entry corresponding to a hash key value in which a hash conflict occurs, and uses a root table to store a hash table entry corresponding to each hash key value, and a linked list information item. The linked list information item is used to indicate whether there is a hash table corresponding to each hash key value in the linked list; obtaining a hash key value and a hash table item to be stored; and reading the root table according to the obtained hash key value; Storage data; when the stored data is not included in the stored data, the hash table item to be stored is stored in the root table; when the stored data includes the linked list information item, the The hash table items to be stored are stored in the linked list. In this way, the number of hash collisions is increased.

Claims (17)

  1. 一种哈希表管理的方法,所述方法包括:A method of hash table management, the method comprising:
    使用链表存储发生哈希冲突的哈希键值对应的哈希表项,使用根表存储各个哈希键值对应的哈希表项、以及链表信息项,所述链表信息项用于指示链表中是否存在每个哈希键值对应的哈希表项;The linked list is used to store the hash table corresponding to the hash key value of the hash conflict, and the root table is used to store the hash table corresponding to each hash key value and the linked list information item, where the linked list information item is used to indicate the linked list. Whether there is a hash table entry corresponding to each hash key value;
    获取哈希键值以及待存储的哈希表项;Obtaining a hash key value and a hash table item to be stored;
    依据所获取的哈希键值读取根表中的存储数据;在读取的存储数据中不包括链表信息项时,将所述待存储的哈希表项存储至根表中;在读取的存储数据中包括链表信息项时,将所述待存储的哈希表项存储至链表中。Reading the stored data in the root table according to the obtained hash key value; storing the hash table item to be stored in the root table when the stored storage data does not include the linked list information item; When the stored data includes the linked list information item, the hash table item to be stored is stored in the linked list.
  2. 根据权利要求1所述的方法,其中,在获取哈希键值后,所述方法还包括:根据所述根表对应的哈希函数,对所获取的哈希键值进行哈希计算,得到第一哈希值;The method according to claim 1, wherein after obtaining the hash key value, the method further comprises: performing a hash calculation on the obtained hash key value according to the hash function corresponding to the root table, First hash value;
    所述将所述待存储的哈希表项存储至根表中,包括:The storing the hash table item to be stored into the root table includes:
    所述根表中存在第一哈希值对应的哈希表项,在所述根表中根据第一哈希值读取哈希表项,在所获取的哈希键值与根表中读取出的哈希表项中的哈希键值匹配时,将所述根表中第一哈希值对应的哈希表项更新为待存储的哈希表项;在所获取的哈希键值与根表中读取出的哈希表项中的哈希键值不匹配,且所述根表中还存在哈希表项的存储位置时,在所述根表中插入待存储的哈希表项;The hash table corresponding to the first hash value exists in the root table, and the hash table entry is read according to the first hash value in the root table, and the obtained hash key value and the root table are read. When the hash key value in the extracted hash table item matches, the hash table corresponding to the first hash value in the root table is updated to the hash table item to be stored; the obtained hash key is obtained. If the value does not match the hash key value in the hash table entry read in the root table, and the storage location of the hash table entry still exists in the root table, insert the to-be-stored in the root table. History entry
    所述根表中不存在第一哈希值对应的哈希表项时,在所述根表中插入待存储的哈希表项。When the hash table corresponding to the first hash value does not exist in the root table, the hash table entry to be stored is inserted into the root table.
  3. 根据权利要求1所述的方法,其中,所述使用链表存储发生哈希冲突的哈希键值对应的哈希表项,包括:The method of claim 1, wherein the using the linked list to store the hash table entry corresponding to the hash key value in which the hash collision occurs includes:
    在读取的存储数据中不包括链表信息项,且所获取的哈希键值与根 表中读取出的哈希表项中的哈希键值不匹配,且所述根表中不存在哈希表项的存储位置时,建立链表,在建立的链表中插入待存储的哈希表项。The linked list information item is not included in the read stored data, and the obtained hash key value and root are obtained. If the hash key values in the hash table entries in the table do not match, and the storage location of the hash table entries does not exist in the root table, the linked list is created, and the hash to be stored is inserted in the established linked list. Entry.
  4. 根据权利要求3所述的方法,其中,在所述链表中插入待存储的哈希表项后,所述方法还包括:基于链表中插入的哈希表项,在所述根表中更新链表信息项。The method according to claim 3, wherein after inserting the hash table entry to be stored in the linked list, the method further comprises: updating the linked list in the root table based on the hash table entry inserted in the linked list Information item.
  5. 根据权利要求1所述的方法,其中,所述链表信息项还用于指示链表中存在的哈希表项的地址信息;The method according to claim 1, wherein the linked list information item is further used to indicate address information of a hash entry existing in the linked list;
    所述将所述待存储的哈希表项存储至链表中,包括:The storing the hash table item to be stored into the linked list includes:
    根据所述链表对应的哈希函数,对所获取的哈希键值进行哈希计算,得到第二哈希值;将所述链表信息项中与获取的哈希键值对应的哈希表项的地址信息记为第三哈希值;Performing a hash calculation on the obtained hash key value according to the hash function corresponding to the linked list to obtain a second hash value; and hashing the hash table key corresponding to the obtained hash key value in the linked list information item The address information is recorded as a third hash value;
    在所述第三哈希值与第二哈希值相同时,在所述链表中根据第二哈希值读取哈希表项,在所获取的哈希键值与链表中读取出的哈希表项中的哈希键值匹配时,将所述链表中第二哈希值对应的哈希表项更新为待存储的哈希表项;在所获取的哈希键值与读取出的哈希表项中的哈希键值不匹配时,在所述链表中插入待存储的哈希表项;When the third hash value is the same as the second hash value, the hash table entry is read according to the second hash value in the linked list, and the obtained hash key value and the linked list are read out. When the hash key value in the hash table matches, the hash table corresponding to the second hash value in the linked list is updated to the hash table to be stored; the hash key value and the read are obtained. When the hash key values in the hash table entries do not match, the hash table entries to be stored are inserted into the linked list;
    在所述第三哈希值与第二哈希值不相同时,在所述链表中插入待存储的哈希表项。When the third hash value is different from the second hash value, a hash table entry to be stored is inserted in the linked list.
  6. 根据权利要求5所述的方法,其中,在所述链表中插入待存储的哈希表项后,所述方法包括:基于插入的哈希表项更新链表信息项。The method according to claim 5, wherein after inserting the hash table entry to be stored in the linked list, the method comprises: updating the linked list information item based on the inserted hash table entry.
  7. 根据权利要求1所述的方法,其中,所述方法还包括:The method of claim 1 wherein the method further comprises:
    获取用于进行哈希查找的查找键值;Get the lookup key value used to perform the hash lookup;
    根据查找键值在根表中进行哈希表项查找,得到哈希表项查找结果;The hash table entry is searched in the root table according to the search key value, and the hash table entry search result is obtained;
    在哈希表项查找结果指示根表中存在所述查找键值对应的哈希表项时,在所述哈希表项查找结果中确定根表中与所述查找键值对应的哈希 表项;When the hash table entry search result indicates that the hash table corresponding to the search key value exists in the root table, determining, in the hash table entry search result, a hash corresponding to the search key value in the root table Entry
    在哈希表项查找结果指示根表中不存在所述查找键值对应的哈希表项时,根据查找键值在链表中进行哈希表项查找,得到链表中与所述查找键值对应的哈希表项。When the hash table entry search result indicates that the hash table corresponding to the search key value does not exist in the root table, the hash table entry is searched in the linked list according to the search key value, and the linked list is matched with the search key value. Hash table entry.
  8. 根据权利要求1所述的方法,其中,所述方法还包括:预先设置第一存储空间和第二存储空间,所述第二存储空间的容量大于第一存储空间的容量;The method according to claim 1, wherein the method further comprises: presetting a first storage space and a second storage space, wherein the capacity of the second storage space is greater than the capacity of the first storage space;
    将所述根表中的哈希表项存储于第一存储空间或第二存储空间,将所述链表中的哈希表项存储于第二存储空间。The hash table entries in the root table are stored in the first storage space or the second storage space, and the hash table entries in the linked list are stored in the second storage space.
  9. 一种哈希表管理的装置,所述装置包括:链表和根表,其中:A device for managing a hash table, the device comprising: a linked list and a root table, wherein:
    链表,配置为存储发生哈希冲突的哈希键值对应的哈希表项;a linked list configured to store a hash table entry corresponding to a hash key value in which a hash conflict occurs;
    根表,配置为存储链表信息项和各个哈希键值对应的哈希表项,所述链表信息项用于指示链表中是否存在每个哈希键值对应的哈希表项;The root table is configured to store a linked list information item and a hash table entry corresponding to each hash key value, where the linked list information item is used to indicate whether a hash table entry corresponding to each hash key value exists in the linked list;
    所述装置还包括:获取模块和处理模块;其中,The device further includes: an obtaining module and a processing module; wherein
    获取模块,配置为获取哈希键值以及待存储的哈希表项;Obtaining a module, configured to obtain a hash key value and a hash table item to be stored;
    处理模块,配置为依据所获取的哈希键值读取根表中的存储数据;在读取的存储数据中不包括链表信息项时,将所述待存储的哈希表项存储至根表中;在读取的存储数据中包括链表信息项时,将所述待存储的哈希表项存储至链表中。The processing module is configured to: read the stored data in the root table according to the obtained hash key value; and store the hash table item to be stored to the root table when the stored storage data does not include the linked list information item The hash table item to be stored is stored in the linked list when the linked list information item is included in the read storage data.
  10. 根据权利要求9所述的装置,其中,所述处理模块,还配置为根据所述根表对应的哈希函数,对所获取的哈希键值进行哈希计算,得到第一哈希值;The apparatus according to claim 9, wherein the processing module is further configured to perform a hash calculation on the obtained hash key value according to a hash function corresponding to the root table to obtain a first hash value;
    相应地,所述处理模块,还配置为在所述根表中存在第一哈希值对应的哈希表项,在所述根表中根据第一哈希值读取哈希表项,在所获取的哈希键值与根表中读取出的哈希表项中的哈希键值匹配时,将所述根 表中第一哈希值对应的哈希表项更新为待存储的哈希表项;在所获取的哈希键值与根表中读取出的哈希表项中的哈希键值不匹配,且所述根表中还存在哈希表项的存储位置时,在所述根表中插入待存储的哈希表项;在所述根表中不存在第一哈希值对应的哈希表项时,在所述根表中插入待存储的哈希表项。Correspondingly, the processing module is further configured to: in the root table, a hash table entry corresponding to the first hash value, where the hash table entry is read according to the first hash value, The root is obtained when the obtained hash key value matches the hash key value in the hash table entry read in the root table. The hash table corresponding to the first hash value in the table is updated to the hash table entry to be stored; the hash key value in the hash key value read from the hash table and the hash table read in the root table is not If the storage location of the hash table entry exists in the root table, the hash table entry to be stored is inserted in the root table; the first hash value does not exist in the root table. When a table entry is selected, a hash table entry to be stored is inserted in the root table.
  11. 根据权利要求9所述的装置,其中,所述处理模块,还配置为在读取的存储数据中不包括链表信息项,且所获取的哈希键值与根表中读取出的哈希表项中的哈希键值不匹配,且所述根表中不存在哈希表项的存储位置时,建立链表,在建立的链表中插入待存储的哈希表项。The apparatus according to claim 9, wherein the processing module is further configured to not include the linked list information item in the read stored data, and the obtained hash key value and the hash read in the root table If the hash key in the entry does not match, and the storage location of the hash entry does not exist in the root table, the linked list is created, and the hash table to be stored is inserted in the established linked list.
  12. 根据权利要求11所述的装置,其中,所述处理模块,还配置为在所述链表中插入待存储的哈希表项后,基于链表中插入的哈希表项,在所述根表中更新链表信息项。The device according to claim 11, wherein the processing module is further configured to: after inserting a hash table entry to be stored in the linked list, based on a hash table entry inserted in the linked list, in the root table Update the linked list information item.
  13. 根据权利要求9所述的装置,其中,所述链表信息项还用于指示链表中存在的哈希表项的地址信息;The apparatus according to claim 9, wherein the linked list information item is further used to indicate address information of a hash entry existing in the linked list;
    所述处理模块,还配置为根据所述链表对应的哈希函数,对所获取的哈希键值进行哈希计算,得到第二哈希值;将所述链表信息项中与获取的哈希键值对应的哈希表项的地址信息记为第三哈希值;The processing module is further configured to perform a hash calculation on the obtained hash key value according to the hash function corresponding to the linked list, to obtain a second hash value, and obtain the hash in the linked list information item. The address information of the hash table corresponding to the key value is recorded as a third hash value;
    所述处理模块,还配置为在所述第三哈希值与第二哈希值相同时,在所述链表中根据第二哈希值读取哈希表项,在所获取的哈希键值与链表中读取出的哈希表项中的哈希键值匹配时,将所述链表中第二哈希值对应的哈希表项更新为待存储的哈希表项;在所获取的哈希键值与读取出的哈希表项中的哈希键值不匹配时,在所述链表中插入待存储的哈希表项;在所述第三哈希值与第二哈希值不相同时,在所述链表中插入待存储的哈希表项。The processing module is further configured to: when the third hash value and the second hash value are the same, read the hash table entry according to the second hash value in the linked list, and obtain the hash key When the value matches the hash key value in the hash table entry in the linked list, the hash table corresponding to the second hash value in the linked list is updated to the hash table to be stored; When the hash key value does not match the hash key value in the read hash table entry, the hash table entry to be stored is inserted in the linked list; the third hash value and the second hash value are When the hash values are different, the hash table entry to be stored is inserted in the linked list.
  14. 根据权利要求13所述的装置,其中,所述处理模块,还配置为 在所述链表中插入待存储的哈希表项后,基于插入的哈希表项更新链表信息项。The apparatus of claim 13, wherein the processing module is further configured to After the hash table entry to be stored is inserted in the linked list, the linked list information item is updated based on the inserted hash table entry.
  15. 根据权利要求9所述的装置,其中,所述装置还包括:查找模块;The apparatus of claim 9, wherein the apparatus further comprises: a lookup module;
    所述查找模块,还配置为获取用于进行哈希查找的查找键值;根据查找键值在根表中进行哈希表项查找,得到哈希表项查找结果;在哈希表项查找结果指示根表中存在所述查找键值对应的哈希表项时,在所述哈希表项查找结果中确定根表中与所述查找键值对应的哈希表项;在哈希表项查找结果指示根表中不存在所述查找键值对应的哈希表项时,根据查找键值在链表中进行哈希表项查找,得到链表中与所述查找键值对应的哈希表项。The search module is further configured to obtain a lookup key value for performing a hash search; perform a hash table item search in the root table according to the search key value, and obtain a hash table item search result; and search results in the hash table item. When the hash table entry corresponding to the search key value exists in the root table, the hash table entry corresponding to the search key value in the root table is determined in the hash table entry search result; in the hash table entry If the search result indicates that the hash table corresponding to the search key value does not exist in the root table, the hash table entry is searched in the linked list according to the search key value, and the hash table corresponding to the search key value in the linked list is obtained. .
  16. 根据权利要求9所述的装置,其中,所述装置还包括:第一存储空间和第二存储空间,所述第二存储空间的容量大于第一存储空间的容量;The device according to claim 9, wherein the device further comprises: a first storage space and a second storage space, the capacity of the second storage space being greater than the capacity of the first storage space;
    所述根表中的哈希表项的存储位置为第一存储空间或第二存储空间,所述链表中的哈希表项的存储位置为第二存储空间。The storage location of the hash table entry in the root table is the first storage space or the second storage space, and the storage location of the hash table entry in the linked list is the second storage space.
  17. 一种计算机存储介质,所述计算机存储介质中存储有计算机可执行指令,该计算机可执行指令配置为执行权利要求1-8任一项所述的哈希表管理的方法。 A computer storage medium having computer executable instructions stored thereon, the computer executable instructions being configured to perform the method of hash table management of any of claims 1-8.
PCT/CN2017/094249 2016-12-02 2017-07-25 Hash table management method and device, and computer storage medium WO2018099107A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201611102346.8 2016-12-02
CN201611102346.8A CN108153757B (en) 2016-12-02 2016-12-02 Hash table management method and device

Publications (1)

Publication Number Publication Date
WO2018099107A1 true WO2018099107A1 (en) 2018-06-07

Family

ID=62241924

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/094249 WO2018099107A1 (en) 2016-12-02 2017-07-25 Hash table management method and device, and computer storage medium

Country Status (2)

Country Link
CN (1) CN108153757B (en)
WO (1) WO2018099107A1 (en)

Cited By (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109558423A (en) * 2018-10-31 2019-04-02 深圳壹账通智能科技有限公司 A kind of data search method based on key-value pair, device and equipment
CN109670083A (en) * 2018-12-13 2019-04-23 武汉中元华电科技股份有限公司 A kind of FPGA realization device and method based on dynamic memory distribution storage HASH chained list
CN110968267A (en) * 2019-11-15 2020-04-07 北京乐我无限科技有限责任公司 Data management method, device, server and system
CN111177476A (en) * 2019-12-05 2020-05-19 北京百度网讯科技有限公司 Data query method and device, electronic equipment and readable storage medium
CN111221823A (en) * 2019-12-31 2020-06-02 上海铿诚智能科技有限公司 Data processing method and device based on link management table
CN111488371A (en) * 2020-04-07 2020-08-04 中国人民财产保险股份有限公司 Data query method and device
CN111756709A (en) * 2020-06-09 2020-10-09 杭州孝道科技有限公司 Method for reducing vulnerability repeated detection in interactive application detection
CN111813971A (en) * 2019-04-10 2020-10-23 阿里巴巴集团控股有限公司 Hash table construction and image matching method and device, storage medium and electronic equipment
CN112463214A (en) * 2019-09-09 2021-03-09 北京京东振世信息技术有限公司 Data processing method and device, computer readable storage medium and electronic device
CN113672524A (en) * 2021-08-20 2021-11-19 上海哔哩哔哩科技有限公司 Data processing method and system based on multi-level cache
CN113726660A (en) * 2021-08-27 2021-11-30 西安微电子技术研究所 Route finder and method based on perfect hash algorithm
CN114064572A (en) * 2021-11-12 2022-02-18 苏州慧工云信息科技有限公司 Object storage method and system based on Hash algorithm
CN114063931A (en) * 2021-11-26 2022-02-18 重庆科创职业学院 Data storage method based on big data
CN114153391A (en) * 2021-11-26 2022-03-08 山东云海国创云计算装备产业创新中心有限公司 Data storage method, device and equipment based on register and storage medium
CN114969913A (en) * 2022-05-24 2022-08-30 国网北京市电力公司 Three-dimensional model component instantiation method, system, equipment and medium
CN115576954A (en) * 2022-11-24 2023-01-06 恒生电子股份有限公司 Hash table determining method and device
CN116401258A (en) * 2023-06-06 2023-07-07 支付宝(杭州)信息技术有限公司 Data indexing method, data query method and corresponding devices
CN117112575A (en) * 2023-10-20 2023-11-24 杭州行芯科技有限公司 Name management method, system and query method for circuit elements

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109460406B (en) * 2018-10-15 2021-03-23 咪咕文化科技有限公司 Data processing method and device
CN110781091B (en) * 2019-10-31 2023-10-27 北京奇艺世纪科技有限公司 Application program testing method and device, electronic equipment and storage medium
CN111259203B (en) * 2020-01-08 2023-08-25 上海兆芯集成电路股份有限公司 Data compressor and data compression method
CN111858586B (en) * 2020-07-06 2024-04-09 北京天空卫士网络安全技术有限公司 Data processing method and device
CN112765174B (en) * 2021-01-20 2024-03-29 上海达梦数据库有限公司 Hash connection-based detection method, device, equipment and storage medium
CN113096284B (en) * 2021-03-19 2022-08-30 福建新大陆通信科技股份有限公司 CTID access control authorization information verification method
CN114338529B (en) * 2021-12-29 2024-03-08 杭州迪普信息技术有限公司 Five-tuple rule matching method and device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103064948A (en) * 2012-12-27 2013-04-24 中国航空工业集团公司第六三一研究所 Content addressing method based on hash chain table and corresponding storage circuit
CN103106144A (en) * 2011-11-15 2013-05-15 北京新媒传信科技有限公司 Compressing method and device of internal storage index
CN104572983A (en) * 2014-12-31 2015-04-29 北京锐安科技有限公司 Construction method based on hash table of memory, text searching method and corresponding device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101692651B (en) * 2009-09-27 2014-12-31 中兴通讯股份有限公司 Method and device for Hash lookup table

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103106144A (en) * 2011-11-15 2013-05-15 北京新媒传信科技有限公司 Compressing method and device of internal storage index
CN103064948A (en) * 2012-12-27 2013-04-24 中国航空工业集团公司第六三一研究所 Content addressing method based on hash chain table and corresponding storage circuit
CN104572983A (en) * 2014-12-31 2015-04-29 北京锐安科技有限公司 Construction method based on hash table of memory, text searching method and corresponding device

Cited By (29)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109558423A (en) * 2018-10-31 2019-04-02 深圳壹账通智能科技有限公司 A kind of data search method based on key-value pair, device and equipment
CN109670083A (en) * 2018-12-13 2019-04-23 武汉中元华电科技股份有限公司 A kind of FPGA realization device and method based on dynamic memory distribution storage HASH chained list
CN109670083B (en) * 2018-12-13 2023-03-24 武汉中元华电科技股份有限公司 FPGA implementation device and method for storing HASH linked list based on dynamic memory allocation
CN111813971A (en) * 2019-04-10 2020-10-23 阿里巴巴集团控股有限公司 Hash table construction and image matching method and device, storage medium and electronic equipment
CN112463214B (en) * 2019-09-09 2023-11-03 北京京东振世信息技术有限公司 Data processing method and device, computer readable storage medium and electronic equipment
CN112463214A (en) * 2019-09-09 2021-03-09 北京京东振世信息技术有限公司 Data processing method and device, computer readable storage medium and electronic device
CN110968267A (en) * 2019-11-15 2020-04-07 北京乐我无限科技有限责任公司 Data management method, device, server and system
CN111177476B (en) * 2019-12-05 2023-08-18 北京百度网讯科技有限公司 Data query method, device, electronic equipment and readable storage medium
CN111177476A (en) * 2019-12-05 2020-05-19 北京百度网讯科技有限公司 Data query method and device, electronic equipment and readable storage medium
CN111221823B (en) * 2019-12-31 2023-05-23 上海铿诚智能科技有限公司 Data processing method and device based on link management table
CN111221823A (en) * 2019-12-31 2020-06-02 上海铿诚智能科技有限公司 Data processing method and device based on link management table
CN111488371A (en) * 2020-04-07 2020-08-04 中国人民财产保险股份有限公司 Data query method and device
CN111756709A (en) * 2020-06-09 2020-10-09 杭州孝道科技有限公司 Method for reducing vulnerability repeated detection in interactive application detection
CN113672524A (en) * 2021-08-20 2021-11-19 上海哔哩哔哩科技有限公司 Data processing method and system based on multi-level cache
CN113726660A (en) * 2021-08-27 2021-11-30 西安微电子技术研究所 Route finder and method based on perfect hash algorithm
CN114064572A (en) * 2021-11-12 2022-02-18 苏州慧工云信息科技有限公司 Object storage method and system based on Hash algorithm
CN114064572B (en) * 2021-11-12 2024-03-19 苏州慧工云信息科技有限公司 Object storage method and system based on hash algorithm
CN114153391A (en) * 2021-11-26 2022-03-08 山东云海国创云计算装备产业创新中心有限公司 Data storage method, device and equipment based on register and storage medium
CN114063931B (en) * 2021-11-26 2023-04-25 重庆科创职业学院 Data storage method based on big data
CN114153391B (en) * 2021-11-26 2024-02-27 山东云海国创云计算装备产业创新中心有限公司 Data storage method, device, equipment and storage medium based on register
CN114063931A (en) * 2021-11-26 2022-02-18 重庆科创职业学院 Data storage method based on big data
CN114969913A (en) * 2022-05-24 2022-08-30 国网北京市电力公司 Three-dimensional model component instantiation method, system, equipment and medium
CN114969913B (en) * 2022-05-24 2024-03-15 国网北京市电力公司 Method, system, equipment and medium for instantiating three-dimensional model component
CN115576954B (en) * 2022-11-24 2023-04-07 恒生电子股份有限公司 Hash table determining method and device
CN115576954A (en) * 2022-11-24 2023-01-06 恒生电子股份有限公司 Hash table determining method and device
CN116401258A (en) * 2023-06-06 2023-07-07 支付宝(杭州)信息技术有限公司 Data indexing method, data query method and corresponding devices
CN116401258B (en) * 2023-06-06 2023-09-22 支付宝(杭州)信息技术有限公司 Data indexing method, data query method and corresponding devices
CN117112575A (en) * 2023-10-20 2023-11-24 杭州行芯科技有限公司 Name management method, system and query method for circuit elements
CN117112575B (en) * 2023-10-20 2024-02-13 杭州行芯科技有限公司 Name management method, system and query method for circuit elements

Also Published As

Publication number Publication date
CN108153757A (en) 2018-06-12
CN108153757B (en) 2020-04-03

Similar Documents

Publication Publication Date Title
WO2018099107A1 (en) Hash table management method and device, and computer storage medium
WO2017114205A1 (en) Short link processing method, device and server
CN109416694B (en) Key-value storage system including resource-efficient index
JP5996088B2 (en) Cryptographic hash database
JP6356675B2 (en) Aggregation / grouping operation: Hardware implementation of hash table method
US8745063B2 (en) Hashing with hardware-based reorder using duplicate values
CN109213699B (en) Metadata management method, system, equipment and computer readable storage medium
US8719237B2 (en) Method and apparatus for deleting duplicate data
US11113199B2 (en) Low-overhead index for a flash cache
WO2018036549A1 (en) Distributed database query method and device, and management system
JP2018502373A (en) System and method for performing a distributed tree scan using hardware-based processing
WO2020177536A1 (en) Transaction deduplication method, transaction construction method, device and storage medium
Xiao et al. Using parallel bloom filters for multiattribute representation on network services
US9928178B1 (en) Memory-efficient management of computer network resources
WO2013091167A1 (en) Log storage method and system
CN112015820A (en) Method, system, electronic device and storage medium for implementing distributed graph database
CN108460030B (en) Set element judgment method based on improved bloom filter
WO2022156650A1 (en) Data access method and apparatus
WO2012013023A2 (en) Hash search method for reducing hash conflicts
WO2019019382A1 (en) Cache handling method and device, computer device and storage medium
WO2020024446A1 (en) Data storage method and apparatus, storage medium, and computer device
CN116991855B (en) Hash table processing method, device, equipment, medium, controller and solid state disk
JP6189266B2 (en) Data processing apparatus, data processing method, and data processing program
US9129033B1 (en) Caching efficiency using a metadata cache
CN111104435B (en) Metadata organization method, device and equipment and computer readable storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17875955

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 17875955

Country of ref document: EP

Kind code of ref document: A1