Bug Report
On current main, StorageBackendAdaptor::ScanMeta() is not safe as a recovery operation.
Two related problems are visible in the current implementation:
- Every scan increments the member counters
total_keys and total_size without resetting or recomputing them. FileStorage::ReRegisterOffloadedObjects() reruns ScanMeta() on the same backend after master metadata loss, so repeated recovery scans inflate the usage counters.
- Each regular file is passed directly to
struct_pb::from_pb(). The decoder throws on malformed/truncated input, but ScanMeta() does not catch per-record exceptions. A single partial or corrupted cache file can therefore abort startup or repeated master-recovery scans.
The existing adaptor test avoids calling ScanMeta() twice on one instance specifically to avoid double-counting, which leaves the production rescan path uncovered.
Expected behavior
A successful full scan should replace the recovered usage totals rather than accumulate them, and one malformed cache file should be logged and skipped without preventing valid files from being re-registered.
Before submitting...
Bug Report
On current
main,StorageBackendAdaptor::ScanMeta()is not safe as a recovery operation.Two related problems are visible in the current implementation:
total_keysandtotal_sizewithout resetting or recomputing them.FileStorage::ReRegisterOffloadedObjects()rerunsScanMeta()on the same backend after master metadata loss, so repeated recovery scans inflate the usage counters.struct_pb::from_pb(). The decoder throws on malformed/truncated input, butScanMeta()does not catch per-record exceptions. A single partial or corrupted cache file can therefore abort startup or repeated master-recovery scans.The existing adaptor test avoids calling
ScanMeta()twice on one instance specifically to avoid double-counting, which leaves the production rescan path uncovered.Expected behavior
A successful full scan should replace the recovered usage totals rather than accumulate them, and one malformed cache file should be logged and skipped without preventing valid files from being re-registered.
Before submitting...