diff options
| author | Chris Lu <chris.lu@gmail.com> | 2019-05-04 08:47:11 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2019-05-04 08:47:11 -0700 |
| commit | 177f3add8166d53dd9f6fce7549e9f3afb828216 (patch) | |
| tree | 270d528016dd8de4cc9c781556fb19c5c99cd971 | |
| parent | 25941e0500de02f539cc6629e549e7e0096cc2eb (diff) | |
| download | seaweedfs-177f3add8166d53dd9f6fce7549e9f3afb828216.tar.xz seaweedfs-177f3add8166d53dd9f6fce7549e9f3afb828216.zip | |
adjust memory layout to avoid possible nil pointer
| -rw-r--r-- | weed/storage/needle_map.go | 4 | ||||
| -rw-r--r-- | weed/storage/needle_map_memory.go | 3 |
2 files changed, 3 insertions, 4 deletions
diff --git a/weed/storage/needle_map.go b/weed/storage/needle_map.go index a22125682..634685175 100644 --- a/weed/storage/needle_map.go +++ b/weed/storage/needle_map.go @@ -37,10 +37,10 @@ type NeedleMapper interface { } type baseNeedleMapper struct { + mapMetric + indexFile *os.File indexFileAccessLock sync.Mutex - - mapMetric } func (nm *baseNeedleMapper) IndexFileSize() uint64 { diff --git a/weed/storage/needle_map_memory.go b/weed/storage/needle_map_memory.go index 727049a13..bda4a5c8f 100644 --- a/weed/storage/needle_map_memory.go +++ b/weed/storage/needle_map_memory.go @@ -10,9 +10,8 @@ import ( ) type NeedleMap struct { - m needle_map.NeedleValueMap - baseNeedleMapper + m needle_map.NeedleValueMap } func NewCompactNeedleMap(file *os.File) *NeedleMap { |
