🔴 [H5] 后台索引器:索引快照与缓存哈希不匹配 #5

Closed
opened 2026-06-03 13:52:51 +08:00 by dailz · 0 comments
Owner

文件: core/io/progressive_reader.rs:315-317
分类: 缓存一致性

问题: spawn_indexer 从 mmap 快照构建 LineIndex,然后 IndexCache::save() 重新打开文件路径计算哈希。如果文件在两步之间变化,会把旧索引存为新文件的缓存

let line_index = LineIndex::from_bytes(data);      // 快照 A
let _ = IndexCache::save(&path, &line_index);       // 哈希来自当前文件 → 快照 B

建议修复: 从同一快照计算并存储指纹,或在索引前后校验元数据。

**文件**: `core/io/progressive_reader.rs:315-317` **分类**: 缓存一致性 **问题**: `spawn_indexer` 从 mmap 快照构建 `LineIndex`,然后 `IndexCache::save()` 重新打开文件路径计算哈希。如果文件在两步之间变化,会把**旧索引**存为**新文件的缓存**。 ```rust let line_index = LineIndex::from_bytes(data); // 快照 A let _ = IndexCache::save(&path, &line_index); // 哈希来自当前文件 → 快照 B ``` **建议修复**: 从同一快照计算并存储指纹,或在索引前后校验元数据。
dailz added the area/concurrencybugseverity/high labels 2026-06-03 13:52:51 +08:00
dailz closed this issue 2026-06-04 13:30:23 +08:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: dailz/logViewer#5