Skip to content
Snippets Groups Projects
Commit 6d68a630 authored by Magomed Kostoev's avatar Magomed Kostoev Committed by Vladimir Davydov
Browse files

box: fix the comparison in the functions cache

Before this patch it could happen that deletion of a function from
the function cache didn't delete it from the funcs_by_name map. The
reason is that the check if the function exists in the map performs
the comparison of the search result with the `end` backet ID of the
wrong hash table.

The situation in which this could happen is the following:
1. Insertion of a new function into the cache triggers resize of the
   funcs_by_value map, but the size of the funcs map remains the same.
2. Then user deletes a function. This removes the function from the
   funcs map. Then we check if the function exists in the
   funcs_by_value map. The function exists there, but it so happens
   that it's bucket ID equals to the funcs map bucket count, so the
   incorrect check if the function exists in the funcs_by_value map
   states that the function does not exist there, so it's not dropped
   from the map.
3. Now we have the following result: the function is referenced in
   the funcs_by_value map, but not in funcs map. This triggers the
   assertion failure on any attempt to insert a new function with
   the same name.

Closes #9426

NO_DOC=bugfix
parent e977efae
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment