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.

SkipListElementReference can be an empty object

Chris Lu513fed323a86
diff --git a/weed/util/skiplist/skiplist_serde.go b/weed/util/skiplist/skiplist_serde.go
index 5b7089e80b..e528b8a3d9 100644
--- a/weed/util/skiplist/skiplist_serde.go
+++ b/weed/util/skiplist/skiplist_serde.go
@@ -34,8 +34,18 @@ func (t *SkipList) deleteElement(element *SkipListElement) error {
}
func (t *SkipList) loadElement(ref *SkipListElementReference) (*SkipListElement, error) {
- if ref == nil {
+ if ref.IsNil() {
return nil, nil
}
return t.listStore.LoadElement(ref.ElementPointer)
}
+
+func (ref *SkipListElementReference) IsNil() bool {
+ if ref == nil {
+ return true
+ }
+ if len(ref.Key) == 0 {
+ return true
+ }
+ return false
+}
\ No newline at end of file