CanonicalizePath sits on the hot path of FindBeadsDir, which every audit Append and every store open calls. On darwin it walked the path component-by-component doing an os.ReadDir of EVERY ancestor directory to recover the authored case. That is O(entries) per ancestor, per call: on a fleet machine whose $TMPDIR held ~97k leftover test directories one call cost ~640ms, so internal/audit's 8000-append concurrency test needed ~85 minutes and looked like a deadlock, and internal/storage/embeddeddolt and cmd/bd blew their package timeouts the same way. Ask the kernel instead: darwin's F_GETPATH fcntl returns the vnode's true (authored-case, symlink- and firmlink-resolved) path in one syscall, whose cost does not depend on directory fan-out. The portable component walk is kept as the fallback for any error other than a genuine not-exist/ENOTDIR verdict, and for non-darwin builds. The dolt events.sendingThread and binlogreplication goroutines named in the report are red herrings: both park on 'chan receive' when idle, which is what a goroutine dump at timeout shows, not what caused the timeout. go test ./internal/audit/... 10m timeout -> ok 1.2s go test ./internal/storage/embeddeddolt/... 180s timeout -> ok 129.7s
14 lines
470 B
Go
14 lines
470 B
Go
//go:build !darwin
|
|
|
|
package utils
|
|
|
|
import "errors"
|
|
|
|
// errNoFastCanonicalCase reports that no kernel-assisted true-case query is
|
|
// available on this platform. resolveCanonicalCase only consults the fast path
|
|
// on darwin, so this exists purely to keep the package compiling elsewhere.
|
|
var errNoFastCanonicalCase = errors.New("canonical-case fast path unsupported on this platform")
|
|
|
|
func canonicalCaseFast(string) (string, error) {
|
|
return "", errNoFastCanonicalCase
|
|
}
|