aboutsummaryrefslogtreecommitdiff
path: root/postgres-examples/test_client.py
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2025-10-30 20:09:05 -0700
committerchrislu <chris.lu@gmail.com>2025-10-30 20:09:05 -0700
commit3b1755a1ee8594a41f4aa94f9cf84bd1407d30b7 (patch)
tree96663672326ee5432116b5ca0507d91855ed5365 /postgres-examples/test_client.py
parentf3832307663b955429d4724a03a9fac7bb6802ed (diff)
downloadseaweedfs-3b1755a1ee8594a41f4aa94f9cf84bd1407d30b7.tar.xz
seaweedfs-3b1755a1ee8594a41f4aa94f9cf84bd1407d30b7.zip
Fix: Critical data race in MasterClient vidMap
Fixes a critical data race where resetVidMap() was writing to the vidMap pointer while other methods were reading it concurrently without synchronization. Changes: - Removed embedded *vidMap from MasterClient struct - Added vidMapLock (sync.RWMutex) to protect vidMap pointer access - Created minimal public accessor methods for external packages: * GetLocations, GetLocationsClone, GetVidLocations * LookupFileId, LookupVolumeServerUrl * GetDataCenter - Internal code directly locks and accesses vidMap (no extra indirection) - Updated resetVidMap() to acquire write lock during pointer swap - Updated shell/commands.go to use GetDataCenter() method Design Philosophy: - vidMap already has internal locking for its map operations - This fix specifically protects the vidMap *pointer* from concurrent access - Public methods for external callers, direct locking for internal use - Minimizes wrapper overhead while maintaining thread safety Verified with: go test -race ./weed/wdclient/... (passes) Impact: - Prevents potential panics/crashes from data races - Minimal performance impact (RWMutex for read-heavy workload) - Maintains full backward compatibility
Diffstat (limited to 'postgres-examples/test_client.py')
0 files changed, 0 insertions, 0 deletions