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
consistent 64bit size
Chris Luae2ee379c065
diff --git a/weed/filer2/filechunks.go b/weed/filer2/filechunks.goindex 711488df1c..fe7841fa71 100644--- a/weed/filer2/filechunks.go+++ b/weed/filer2/filechunks.go@@ -75,7 +75,7 @@ type ChunkView struct {isGzipped bool}-func ViewFromChunks(chunks []*filer_pb.FileChunk, offset int64, size int) (views []*ChunkView) {+func ViewFromChunks(chunks []*filer_pb.FileChunk, offset int64, size int64) (views []*ChunkView) {visibles := NonOverlappingVisibleIntervals(chunks)@@ -83,9 +83,9 @@ func ViewFromChunks(chunks []*filer_pb.FileChunk, offset int64, size int) (views}-func ViewFromVisibleIntervals(visibles []VisibleInterval, offset int64, size int) (views []*ChunkView) {+func ViewFromVisibleIntervals(visibles []VisibleInterval, offset int64, size int64) (views []*ChunkView) {- stop := offset + int64(size)+ stop := offset + sizefor _, chunk := range visibles {diff --git a/weed/filer2/filechunks_test.go b/weed/filer2/filechunks_test.goindex bb4a6c74df..7b1133b854 100644--- a/weed/filer2/filechunks_test.go+++ b/weed/filer2/filechunks_test.go@@ -218,7 +218,7 @@ func TestChunksReading(t *testing.T) {testcases := []struct {Chunks []*filer_pb.FileChunkOffset int64- Size int+ Size int64Expected []*ChunkView}{// case 0: normaldiff --git a/weed/filer2/stream.go b/weed/filer2/stream.goindex 0f7c3c176e..8819070ff8 100644--- a/weed/filer2/stream.go+++ b/weed/filer2/stream.go@@ -14,7 +14,7 @@ import ("github.com/chrislusf/seaweedfs/weed/wdclient")-func StreamContent(masterClient *wdclient.MasterClient, w io.Writer, chunks []*filer_pb.FileChunk, offset int64, size int) error {+func StreamContent(masterClient *wdclient.MasterClient, w io.Writer, chunks []*filer_pb.FileChunk, offset int64, size int64) error {chunkViews := ViewFromChunks(chunks, offset, size)@@ -61,7 +61,7 @@ var _ = io.ReadSeeker(&ChunkStreamReader{})func NewChunkStreamReaderFromFiler(masterClient *wdclient.MasterClient, chunks []*filer_pb.FileChunk) *ChunkStreamReader {- chunkViews := ViewFromChunks(chunks, 0, math.MaxInt32)+ chunkViews := ViewFromChunks(chunks, 0, math.MaxInt64)return &ChunkStreamReader{chunkViews: chunkViews,diff --git a/weed/filesys/filehandle.go b/weed/filesys/filehandle.goindex bfdafd5801..1dfaf59444 100644--- a/weed/filesys/filehandle.go+++ b/weed/filesys/filehandle.go@@ -90,7 +90,7 @@ func (fh *FileHandle) readFromChunks(buff []byte, offset int64) (int64, error) {fh.f.reader = nil}if fh.f.reader == nil {- chunkViews := filer2.ViewFromVisibleIntervals(fh.f.entryViewCache, 0, math.MaxInt32)+ chunkViews := filer2.ViewFromVisibleIntervals(fh.f.entryViewCache, 0, math.MaxInt64)fh.f.reader = filer2.NewChunkStreamReaderFromClient(fh.f.wfs, chunkViews)}diff --git a/weed/replication/sink/azuresink/azure_sink.go b/weed/replication/sink/azuresink/azure_sink.goindex 89e04922f6..d75dbe9aff 100644--- a/weed/replication/sink/azuresink/azure_sink.go+++ b/weed/replication/sink/azuresink/azure_sink.go@@ -96,7 +96,7 @@ func (g *AzureSink) CreateEntry(key string, entry *filer_pb.Entry) error {}totalSize := filer2.TotalSize(entry.Chunks)- chunkViews := filer2.ViewFromChunks(entry.Chunks, 0, int(totalSize))+ chunkViews := filer2.ViewFromChunks(entry.Chunks, 0, int64(totalSize))// Create a URL that references a to-be-created blob in your// Azure Storage account's container.diff --git a/weed/replication/sink/b2sink/b2_sink.go b/weed/replication/sink/b2sink/b2_sink.goindex df0653f73a..b5d410a75d 100644--- a/weed/replication/sink/b2sink/b2_sink.go+++ b/weed/replication/sink/b2sink/b2_sink.go@@ -85,7 +85,7 @@ func (g *B2Sink) CreateEntry(key string, entry *filer_pb.Entry) error {}totalSize := filer2.TotalSize(entry.Chunks)- chunkViews := filer2.ViewFromChunks(entry.Chunks, 0, int(totalSize))+ chunkViews := filer2.ViewFromChunks(entry.Chunks, 0, int64(totalSize))bucket, err := g.client.Bucket(context.Background(), g.bucket)if err != nil {diff --git a/weed/replication/sink/gcssink/gcs_sink.go b/weed/replication/sink/gcssink/gcs_sink.goindex 694399274b..b1a8d7753e 100644--- a/weed/replication/sink/gcssink/gcs_sink.go+++ b/weed/replication/sink/gcssink/gcs_sink.go@@ -90,7 +90,7 @@ func (g *GcsSink) CreateEntry(key string, entry *filer_pb.Entry) error {}totalSize := filer2.TotalSize(entry.Chunks)- chunkViews := filer2.ViewFromChunks(entry.Chunks, 0, int(totalSize))+ chunkViews := filer2.ViewFromChunks(entry.Chunks, 0, int64(totalSize))wc := g.client.Bucket(g.bucket).Object(key).NewWriter(context.Background())diff --git a/weed/replication/sink/s3sink/s3_sink.go b/weed/replication/sink/s3sink/s3_sink.goindex e0aee5ada1..5dbc3fdb7d 100644--- a/weed/replication/sink/s3sink/s3_sink.go+++ b/weed/replication/sink/s3sink/s3_sink.go@@ -103,7 +103,7 @@ func (s3sink *S3Sink) CreateEntry(key string, entry *filer_pb.Entry) error {}totalSize := filer2.TotalSize(entry.Chunks)- chunkViews := filer2.ViewFromChunks(entry.Chunks, 0, int(totalSize))+ chunkViews := filer2.ViewFromChunks(entry.Chunks, 0, int64(totalSize))parts := make([]*s3.CompletedPart, len(chunkViews))diff --git a/weed/server/filer_server_handlers_read.go b/weed/server/filer_server_handlers_read.goindex 14414de657..310fbcec49 100644--- a/weed/server/filer_server_handlers_read.go+++ b/weed/server/filer_server_handlers_read.go@@ -102,7 +102,7 @@ func (fs *FilerServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request,}processRangeRequest(r, w, totalSize, mimeType, func(writer io.Writer, offset int64, size int64) error {- return filer2.StreamContent(fs.filer.MasterClient, writer, entry.Chunks, offset, int(size))+ return filer2.StreamContent(fs.filer.MasterClient, writer, entry.Chunks, offset, size)})}diff --git a/weed/server/webdav_server.go b/weed/server/webdav_server.goindex 5a35e05d8b..a7232d8a89 100644--- a/weed/server/webdav_server.go+++ b/weed/server/webdav_server.go@@ -499,7 +499,7 @@ func (f *WebDavFile) Read(p []byte) (readSize int, err error) {f.reader = nil}if f.reader == nil {- chunkViews := filer2.ViewFromVisibleIntervals(f.entryViewCache, 0, math.MaxInt32)+ chunkViews := filer2.ViewFromVisibleIntervals(f.entryViewCache, 0, math.MaxInt64)f.reader = filer2.NewChunkStreamReaderFromClient(f.fs, chunkViews)}diff --git a/weed/shell/command_fs_cat.go b/weed/shell/command_fs_cat.goindex 3db4879791..7d2ac89894 100644--- a/weed/shell/command_fs_cat.go+++ b/weed/shell/command_fs_cat.go@@ -54,7 +54,7 @@ func (c *commandFsCat) Do(args []string, commandEnv *CommandEnv, writer io.Writereturn err}- return filer2.StreamContent(commandEnv.MasterClient, writer, respLookupEntry.Entry.Chunks, 0, math.MaxInt32)+ return filer2.StreamContent(commandEnv.MasterClient, writer, respLookupEntry.Entry.Chunks, 0, math.MaxInt64)})