JakeChampion / JakeChampion/trafficserver
[10.2][cache] aggWriteDone error cleanup uses a byte offset for del_dir, so failed-write dir entries are never removed
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 0
- Forks
- 0
- Avg merge
- 8h 2m
- Merged PRs (30d)
- 21
Description
Branch: 10.2.x (10.2.1, commit 31f1f2f3b) · Severity: medium
Location: src/iocore/cache/StripeSM.cc:761
What's wrong
On an aggregation disk-write failure, aggWriteDone tries to remove every directory entry it inserted for the fragments in the failed buffer. It builds the search key with dir_set_offset(&del_dir, directory.header->write_pos + done) — a raw byte position. But directory entries store a vol/block offset: the insert paths in the same file use dir_set_offset(&vc->dir, this->offset_to_vol_offset(doc_offset)) (StripeSM.cc:950, :967). Because the offsets are in different units, directory.remove() searches for a key that never matches, so the entries for the failed write are left dangling in the directory.
Fix
Convert the byte position to a vol/block offset, matching the insert paths:
dir_set_offset(&del_dir, this->offset_to_vol_offset(directory.header->write_pos + done));
PR attached.
Testing
Compiles cleanly on 10.2.x (libinkcache.a builds). clang-format clean.
From an automated multi-lens audit of the 10.2.x branch. Full report on branch claude/codebase-audit-review-9nw7vz (CODEBASE_AUDIT_10.2.md).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at src/iocore/cache/StripeSM.cc:761 in aggWriteDone, then compare the directory-entry insertion paths at lines 950 and 967 to confirm the offset units. Build libinkcache.a on the 10.2.x branch and verify that failed aggregation writes clean up their directory entries.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100