Commit 662ee1f
committed
Add regression tests for per-file diskcache reuse when streaming remote files
Streaming a proxied remote file (RemoteFile) reopened the per-file chunk
diskcache on essentially every read block, which is cheap on fast storage but
pathologically slow on SD cards. Cover:
- the diskcache is constructed a bounded number of times regardless of file
size (not once per chunk)
- concurrent readers of the same file, and single-read correctness
- the handle self-heals when the chunk directory is evicted and recreated
mid-stream, including dropping a borrowed handle without closing it
- the self-heal mechanism and Windows-safety invariant cross-platform:
_open_cache reopens on an incarnation change, and delete() releases the
handle before removing the directory
- the marker-file fallback used when the filesystem reports no inode
- eviction skips a directory that cannot be removed rather than aborting
The end-to-end deletion flavors are POSIX-only, since Windows forbids removing
a directory whose diskcache is held open; tests release the handle before
removing a directory so it does not block removal there.
Claude-Session: https://claude.ai/code/session_01MnAmUbaCBpL4wBKFYUyCwt1 parent f7cafd4 commit 662ee1f
2 files changed
Lines changed: 352 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
8 | 10 | | |
9 | 11 | | |
10 | 12 | | |
| |||
48 | 50 | | |
49 | 51 | | |
50 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
51 | 56 | | |
52 | 57 | | |
53 | 58 | | |
| |||
167 | 172 | | |
168 | 173 | | |
169 | 174 | | |
170 | | - | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
171 | 178 | | |
172 | 179 | | |
173 | 180 | | |
| |||
182 | 189 | | |
183 | 190 | | |
184 | 191 | | |
185 | | - | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
186 | 195 | | |
187 | 196 | | |
188 | 197 | | |
| |||
274 | 283 | | |
275 | 284 | | |
276 | 285 | | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
277 | 289 | | |
278 | 290 | | |
279 | 291 | | |
| |||
391 | 403 | | |
392 | 404 | | |
393 | 405 | | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
394 | 429 | | |
395 | 430 | | |
396 | 431 | | |
| |||
0 commit comments