Skip to content

Hash code conflict in LRUCache #1352

@flowbehappy

Description

@flowbehappy

Currently, MarkCache and MinMaxIndexCache use LRUCache to manage the mapping. We hash the file path into UInt128, so that it is easy to use an unordered_map. Although it is efficient, the hash algorithm can still have chances of conflicts. i.e. two different paths share the same hash_code. We cannot tolerate the conflict, because it will cause data error or exceptions.

Instead of relying on hash code, we can use std::map<Path, Value>. In sacrificing some efficiency, we gain correctness.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions