Berrysoft commented on code in PR #5807:
URL: https://github.com/apache/opendal/pull/5807#discussion_r2002350082
##########
core/src/services/compfs/reader.rs:
##########
@@ -47,14 +47,18 @@ impl oio::Read for CompfsReader {
async fn read(&mut self) -> Result<Buffer> {
let pos = self.offset;
if let Some(end) = self.end {
- if end >= pos {
+ if end <= pos {
return Ok(Buffer::new());
}
}
let mut bs = self.core.buf_pool.get();
// reserve 64KB buffer by default, we should allow user to configure
this or make it adaptive.
- bs.reserve(64 * 1024);
+ if let Some(end) = self.end {
+ bs.reserve((end - pos) as usize);
+ } else {
+ bs.reserve(64 * 1024);
Review Comment:
Fixed. I think it should work well now.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]