diff --git a/seaweed-volume/src/server/grpc_server.rs b/seaweed-volume/src/server/grpc_server.rs index e1df47dfe..ef35e5dce 100644 --- a/seaweed-volume/src/server/grpc_server.rs +++ b/seaweed-volume/src/server/grpc_server.rs @@ -3029,6 +3029,10 @@ impl VolumeServer for VolumeGrpcService { vid, e ))); } + + // Close old remote backend (matches Go: v.DataBackend.Close(); v.DataBackend = nil) + // This forces the next read to discover and open the local .dat file. + vol.close_remote_dat_backend(); } } } diff --git a/seaweed-volume/src/storage/volume.rs b/seaweed-volume/src/storage/volume.rs index 26e9b6834..28dc761d1 100644 --- a/seaweed-volume/src/storage/volume.rs +++ b/seaweed-volume/src/storage/volume.rs @@ -2090,6 +2090,12 @@ impl Volume { 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) { + self.remote_dat_file = None; + } + /// Path to .vif file. fn vif_path(&self) -> String { format!("{}.vif", self.data_file_name())