Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

adjust memory layout to avoid possible nil pointer

Chris Lu177f3add8166
diff --git a/weed/storage/needle_map.go b/weed/storage/needle_map.go
index a221256828..634685175f 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 727049a134..bda4a5c8f5 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 {