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.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
fix when two consecutive chunks with the same modified_ts_ns
Chris Lu56df44845f02
diff --git a/weed/filer/filechunks_read.go b/weed/filer/filechunks_read.goindex b8768ed63e..11b297a3c0 100644--- a/weed/filer/filechunks_read.go+++ b/weed/filer/filechunks_read.go@@ -38,10 +38,10 @@ func readResolvedChunks(chunks []*filer_pb.FileChunk, startOffset int64, stopOffreturn int(a.ts - b.ts)}if a.isStart {- return -1+ return 1}if b.isStart {- return 1+ return -1}return 0})diff --git a/weed/filer/filechunks_test.go b/weed/filer/filechunks_test.goindex b448950a9f..7554b00804 100644--- a/weed/filer/filechunks_test.go+++ b/weed/filer/filechunks_test.go@@ -553,3 +553,18 @@ func TestViewFromVisibleIntervals3(t *testing.T) {}}++func TestCompactFileChunks3(t *testing.T) {+ chunks := []*filer_pb.FileChunk{+ {Offset: 0, Size: 100, FileId: "abc", ModifiedTsNs: 50},+ {Offset: 100, Size: 100, FileId: "ghi", ModifiedTsNs: 50},+ {Offset: 200, Size: 100, FileId: "jkl", ModifiedTsNs: 100},+ {Offset: 300, Size: 100, FileId: "def", ModifiedTsNs: 200},+ }++ compacted, _ := CompactFileChunks(nil, chunks)++ if len(compacted) != 4 {+ t.Fatalf("unexpected compacted: %d", len(compacted))+ }+}