The InnoDB storage engine uses a hashing algorithm to find the dictionary, and its conflict mechanism takes the form of a linked list, and the hash function uses the division hashing method. For a buffer pool page hash table, a page page in the buffer pool has a chain pointer. It points to the same hash function value of the page. For a division hash, the value of M is slightly greater than twice times the number of buffer pool pages in prime numbers. For example: The current parameter innodb_buffer_pool_size has a size of 10M and a total of 640 16kb pages. For the buffer pool page memory hash table, need to allocate 640*2=1280 slots, but because 1280 is not prime, need to take a prime number slightly larger than 1280, should be 1399, so at startup will allocate 1399 slots of the hash table, used to hash query the page in the buffer pool
So how does the buffer pool in the InnoDB storage engine look for pages in it? Above just gives the general algorithm, how to say the search page converted into natural number?
In fact, the INNODB storage engine table space has a space_id, the user asked to find a table space should be a continuous 16KB of the page, that is, the offset Offset,innodb storage engine will space_id left 20 bits, and then add this Space_ ID and offset, which is the keyword K=space_id<<20+space_id+offset, and then by triggering the hash into each slot
Hashing algorithms in the InnoDB storage engine in MySQL