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(volume): serve reads from remote after tier upload (Rust) (#10112)
Chris Lu66620a1ab834
diff --git a/seaweed-volume/src/server/grpc_server.rs b/seaweed-volume/src/server/grpc_server.rsindex a46971beca..6b97ac4fe2 100644--- a/seaweed-volume/src/server/grpc_server.rs+++ b/seaweed-volume/src/server/grpc_server.rs@@ -3335,9 +3335,15 @@ impl VolumeServer for VolumeGrpcService {)));}- // Close local dat file handle (matches Go's v.LoadRemoteFile- // which closes DataBackend before switching to remote)- vol.close_local_dat_backend();+ // Switch the data backend from the local .dat to the remote+ // object so reads keep working after upload (matches Go's+ // LoadRemoteFile).+ if let Err(e) = vol.load_remote_dat_file() {+ return Err(Status::internal(format!(+ "volume {} failed to load remote file: {}",+ vid, e+ )));+ }// Optionally remove local .dat file from diskif !keep_local {diff --git a/seaweed-volume/src/storage/volume.rs b/seaweed-volume/src/storage/volume.rsindex a83c652e59..9fa355f30d 100644--- a/seaweed-volume/src/storage/volume.rs+++ b/seaweed-volume/src/storage/volume.rs@@ -949,7 +949,7 @@ impl Volume {Ok(())}- fn load_remote_dat_file(&mut self) -> Result<(), VolumeError> {+ pub(crate) fn load_remote_dat_file(&mut self) -> Result<(), VolumeError> {let (storage_name, storage_key) = self.remote_storage_name_key();let backend = crate::remote_storage::s3_tier::global_s3_tier_registry().read()@@ -2225,12 +2225,6 @@ impl Volume {}}- /// Close the local .dat file handle (matches Go's v.DataBackend.Close() in LoadRemoteFile).- /// Called after tier-upload when the local file is being replaced by remote storage.- pub fn close_local_dat_backend(&mut self) {- self.dat_file = None;- }-/// Close the remote dat file backend (matches Go's v.DataBackend.Close(); v.DataBackend = nil)./// Called after tier-download when the remote backend is being replaced by local storage.pub fn close_remote_dat_backend(&mut self) {