SIGN IN SIGN UP

objstorage: cache local object paths

Local object operations repeatedly reconstructed the same filesystem path through base.MakeFilepath because object metadata stored only the file number, file type, and storage tier rather than the complete path. In a focused benchmark, this path construction took approximately 247–256 ns/op and allocated 112 bytes across four allocations per call.

Store the eagerly computed local path in ObjectMetadata.Local.Path. Populate the path when existing hot- and cold-tier objects are discovered at startup, when a new local object is created, and when an object is created through LinkOrCopyFromLocal.

Local path lookup, opening, sizing, and removal now reuse the stored path. Provider.Path retains a fallback for metadata without a populated path.

A focused post-change benchmark runs at approximately 4.13–4.27 ns/op with 0 B/op and 0 allocs/op.

Tests cover newly created hot- and cold-tier objects, startup-discovered objects, reuse of the cached path across local operations, and the fallback path.

Testing:
- go test ./...
- go test -race ./objstorage/objstorageprovider

Fixes #5340.
S
Srinath Shrestha committed
e0818dd07ec580eb229e8291b4eefdb135cd5a55
Parent: 13596f1
Committed by RaduBerinde <radu@cockroachlabs.com> on 9/27/2026, 1:31:09 AM