diff options
| author | chrislu <chris.lu@gmail.com> | 2025-10-30 20:44:33 -0700 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2025-10-30 20:44:33 -0700 |
| commit | c4c4d227a17ebd9d7dec879ee1a693df5559d9cb (patch) | |
| tree | 241fc77902d960b8b0cb0a7d788c23b2ff164193 /postgres-examples/test_client.py | |
| parent | 60f9dea60a8b6d892d35ee94a77bfbc19c0fe402 (diff) | |
| download | seaweedfs-c4c4d227a17ebd9d7dec879ee1a693df5559d9cb.tar.xz seaweedfs-c4c4d227a17ebd9d7dec879ee1a693df5559d9cb.zip | |
Further reduce lock contention in LookupVolumeIdsWithFallback
Optimized two loops that were holding RLock for extended periods:
Before:
- Held RLock during entire loop iteration
- Included string parsing and cache lookups
- Could block resetVidMap for significant time with large batches
After:
- Grab vidMap pointer with brief RLock
- Release lock immediately
- Perform all loop operations on local pointer
Impact:
- First loop: Cache check on initial volumeIds
- Second loop: Double-check after singleflight wait
Benefits:
- Minimal lock hold time (just pointer copy)
- resetVidMap no longer blocked by long loops
- Better concurrent performance with large volume ID lists
- Still thread-safe (vidMap methods have internal locks)
Verified with: go test -race ./weed/wdclient/... (passes)
Diffstat (limited to 'postgres-examples/test_client.py')
0 files changed, 0 insertions, 0 deletions
