fix bitrot readat bug

This commit is contained in:
weisd
2024-11-02 17:53:30 +08:00
parent 4a5443996f
commit 6ab538050d
3 changed files with 65 additions and 37 deletions
+5 -3
View File
@@ -34,8 +34,8 @@ use tokio::{
};
use tokio_stream::wrappers::ReceiverStream;
use tonic::{service::interceptor::InterceptedService, transport::Channel, Request, Status, Streaming};
use tracing::error;
use tracing::info;
use tracing::{error, warn};
use uuid::Uuid;
pub type DiskStore = Arc<Box<dyn DiskAPI>>;
@@ -855,9 +855,11 @@ impl ReadAt for LocalFileReader {
let mut buffer = vec![0; length];
let bytes_read = self.inner.read(&mut buffer).await?;
let bytes_read = self.inner.read_exact(&mut buffer).await?;
buffer.truncate(bytes_read);
// buffer.truncate(bytes_read);
// warn!("LocalFileReader ReadAt need: {}, got: {}", length, bytes_read);
Ok((buffer, bytes_read))
}