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
refactor
Chris Lu59ace549252f
diff --git a/weed/filesys/dirty_pages.go b/weed/filesys/dirty_pages.goindex c056a09ba0..8505323ef3 100644--- a/weed/filesys/dirty_pages.go+++ b/weed/filesys/dirty_pages.go@@ -5,4 +5,6 @@ type DirtyPages interface {FlushData() errorReadDirtyDataAt(data []byte, startOffset int64) (maxStop int64)GetStorageOptions() (collection, replication string)+ SetWriteOnly(writeOnly bool)+ GetWriteOnly() (writeOnly bool)}diff --git a/weed/filesys/dirty_pages_continuous.go b/weed/filesys/dirty_pages_continuous.goindex b4ec88c214..b7514a2eba 100644--- a/weed/filesys/dirty_pages_continuous.go+++ b/weed/filesys/dirty_pages_continuous.go@@ -148,3 +148,13 @@ func (pages *ContinuousDirtyPages) ReadDirtyDataAt(data []byte, startOffset int6func (pages *ContinuousDirtyPages) GetStorageOptions() (collection, replication string) {return pages.collection, pages.replication}++func (pages *ContinuousDirtyPages) SetWriteOnly(writeOnly bool) {+ if pages.writeOnly {+ pages.writeOnly = writeOnly+ }+}++func (pages *ContinuousDirtyPages) GetWriteOnly() (writeOnly bool) {+ return pages.writeOnly+}diff --git a/weed/filesys/filehandle.go b/weed/filesys/filehandle.goindex b23063e287..7a939e87a3 100644--- a/weed/filesys/filehandle.go+++ b/weed/filesys/filehandle.go@@ -284,7 +284,7 @@ func (fh *FileHandle) doFlush(ctx context.Context, header fuse.Header) error {manifestChunks, nonManifestChunks := filer.SeparateManifestChunks(entry.Chunks)chunks, _ := filer.CompactFileChunks(fh.f.wfs.LookupFn(), nonManifestChunks)- chunks, manifestErr := filer.MaybeManifestize(fh.f.wfs.saveDataAsChunk(fh.f.fullpath(), fh.writeOnly), chunks)+ chunks, manifestErr := filer.MaybeManifestize(fh.f.wfs.saveDataAsChunk(fh.f.fullpath(), fh.dirtyPages.GetWriteOnly()), chunks)if manifestErr != nil {// not good, but should be okglog.V(0).Infof("MaybeManifestize: %v", manifestErr)diff --git a/weed/filesys/wfs.go b/weed/filesys/wfs.goindex c71931b022..4096d35955 100644--- a/weed/filesys/wfs.go+++ b/weed/filesys/wfs.go@@ -150,9 +150,7 @@ func (wfs *WFS) AcquireHandle(file *File, uid, gid uint32, writeOnly bool) (filewfs.handlesLock.Unlock()if found && existingHandle != nil {existingHandle.f.isOpen++- if existingHandle.writeOnly {- existingHandle.writeOnly = writeOnly- }+ existingHandle.dirtyPages.SetWriteOnly(writeOnly)glog.V(4).Infof("Acquired Handle %s open %d", fullpath, existingHandle.f.isOpen)return existingHandle}