chitralverma opened a new issue, #9036:
URL: https://github.com/apache/opendal/issues/9036
### OpenDAL version or commit
main (d86cd9245)
### Affected service or component
services/hdfs-native
### Describe the bug
`hdfs-native` reports neither `write_can_multi` nor `write_can_empty`, but
its writer supports both:
- `HdfsNativeWriter::write` streams each `Buffer` to the open
`hdfs_native::file::FileWriter`, so a writer can take any number of chunks.
- `close()` without a `write()` creates and closes a file of length 0.
Because the flags are off, 11 behavior tests in `async_write.rs` return
early for `hdfs-native` without checking anything. Examples are
`test_writer_write`, `test_writer_sink`, `test_writer_futures_copy` and
`test_writer_write_with_if_not_exists`. Callers that check `write_can_multi`
before they stream a large file in chunks treat `hdfs-native` as a one-shot
service.
### Steps to Reproduce
```rust
let op = Operator::from_uri("hdfs-native://127.0.0.1:9000/")?;
let cap = op.info().capability();
assert!(cap.write_can_multi); // fails
assert!(cap.write_can_empty); // fails
let mut w = op.writer("multi").await?;
w.write(vec![1u8; 4]).await?;
w.write(vec![2u8; 4]).await?;
w.close().await?; // succeeds, stat reports 8 bytes
op.write("empty", Vec::<u8>::new()).await?; // succeeds, stat reports 0 bytes
```
### Actual Behavior
Both flags are `false`, so callers and the behavior suite skip multi-chunk
and empty writes.
### Expected Behavior
Both flags are `true`.
### Additional Context
The writes above ran against MiniDFS from the `hdfs-native` repository. With
both flags set, the hdfs-native behavior suite against the same cluster passes
129 of 129 tests, as on main, and the gated tests now run their checks.
### Are you willing to submit a PR to fix this bug?
- [x] I reproduced this issue against the affected component. For a
service-specific report, I used the actual service rather than only a mock,
emulator, or source-code analysis.
- [x] Yes, I would like to submit a PR.
--
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]