refactor(FileDataBuffer): O(1) LRU cache, fix hash mismatch, deduplicate save logic#151
refactor(FileDataBuffer): O(1) LRU cache, fix hash mismatch, deduplicate save logic#151lagcompensation wants to merge 6 commits into
Conversation
There was a problem hiding this comment.
FileDataBuffer.cpp:76-80, 422-434
The reported fix for hash mismatch is not complete. After replaceData(), the file-backed buffer is still forced to memory mode via promoteToMemoryModeLocked(), and computeCurrentHashLocked() still calculates the hash differently in the two modes: qHash(m_data, 0) for materialized and XOR from qHash(readLocked(...), offset) for file-backed. As a result, isModified() can still be true without actually changing the data, if the contents haven't changed, but only the storage mode has.
FileDataBuffer.h:4-10, 107-108
std::list and std::list<...>::iterator have appeared in the header, but #include has not been added. This can currently only be built accidentally due to transitive includes, but any TU that includes this header without them will get a compile error.
Please correct the errors and we will review them again.
Refactor hash computation to use QCryptographicHash for SHA-256.
|
@Altro-O fixed |
returning wrong result after file-backed → memory transition)