diqiu50 commented on code in PR #6280: URL: https://github.com/apache/gravitino/pull/6280#discussion_r1942329270
########## clients/filesystem-fuse/src/open_dal_filesystem.rs: ########## @@ -210,19 +227,44 @@ impl FileReader for FileReaderImpl { struct FileWriterImpl { writer: opendal::Writer, + buffer: Vec<u8>, +} + +impl FileWriterImpl { + fn new(writer: opendal::Writer) -> Self { + Self { + writer, + buffer: Vec::with_capacity(OpenDalFileSystem::WRITE_BUFFER_SIZE + 4096), + } + } } #[async_trait] impl FileWriter for FileWriterImpl { async fn write(&mut self, _offset: u64, data: &[u8]) -> Result<u32> { - self.writer - .write(data.to_vec()) - .await - .map_err(opendal_error_to_errno)?; + if self.buffer.len() > OpenDalFileSystem::WRITE_BUFFER_SIZE { + let mut new_buffer: Vec<u8> = + Vec::with_capacity(OpenDalFileSystem::WRITE_BUFFER_SIZE + 4096); + new_buffer.append(&mut self.buffer); Review Comment: use `swap` ########## clients/filesystem-fuse/src/open_dal_filesystem.rs: ########## @@ -120,14 +122,27 @@ impl PathFileSystem for OpenDalFileSystem { .map_err(opendal_error_to_errno)?; file.reader = Some(Box::new(FileReaderImpl { reader })); } - if flags.is_write() || flags.is_create() || flags.is_append() || flags.is_truncate() { + if !flags.is_create() && flags.is_append() { + error!("The file system does not support open a exists file with the append mode"); + return Err(Errno::from(libc::EBADF)); Review Comment: fix -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@gravitino.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org