aboutsummaryrefslogtreecommitdiff
path: root/postgres-examples
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2025-10-30 20:00:02 -0700
committerchrislu <chris.lu@gmail.com>2025-10-30 20:00:02 -0700
commitd00308399d37870a6a93272b75a76ead1847848c (patch)
tree8c8b1908d06d913c706f2ec86c4750378a5e4b64 /postgres-examples
parente8e50ebc75202fccb6a0c3554a44a7514af65844 (diff)
downloadseaweedfs-d00308399d37870a6a93272b75a76ead1847848c.tar.xz
seaweedfs-d00308399d37870a6a93272b75a76ead1847848c.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 - Added vidMapLock (sync.RWMutex) to protect vidMap pointer access - Created safe accessor methods (GetLocations, GetDataCenter, etc.) - Updated all direct vidMap accesses to use thread-safe methods - Updated resetVidMap() to acquire write lock during pointer swap The vidMap already has internal locking for its operations, but this fix protects the vidMap pointer itself from concurrent read/write races. Verified with: go test -race ./weed/wdclient/... Impact: - Prevents potential panics from concurrent pointer access - No performance impact - uses RWMutex for read-heavy workloads - Maintains backward compatibility through wrapper methods
Diffstat (limited to 'postgres-examples')
0 files changed, 0 insertions, 0 deletions