chitralverma opened a new pull request, #9030: URL: https://github.com/apache/opendal/pull/9030
# Which issue does this PR close? Closes #9029. # Rationale for this change `hdfs-native` does not report `write_with_if_not_exists`. The NameNode can do it atomically: `create` without the overwrite flag fails when the file exists, and the check and the create are one RPC. Applications that ask for exclusive creation, such as DuckDB v2.0 on every `COPY TO` of a new path, cannot write to HDFS today. # What changes are included in this PR? - `hdfs_write` creates the file without overwrite when `if_not_exists` is set, and maps `AlreadyExists` to `ConditionNotMatch`. It skips the existence check that the normal write path does first. - The service reports `write_with_if_not_exists`, and `docs.md` lists it. The hdfs-native behavior suite against a MiniDFS cluster passes 129 tests on main and on this branch. On main, `test_write_with_if_not_exists` and `test_writer_write_with_if_not_exists` return early because the capability is off; on this branch they run their assertions. Through duckdb-opendal, `COPY TO` of a new file and of an existing file works against MiniDFS in plain, HA, router, erasure-coding, Kerberos and KMS modes. # Are there any user-facing changes? `write_with(path).if_not_exists(true)` on `hdfs-native` creates the file, or fails with `ConditionNotMatch` if it exists. Before, it failed with `Unsupported`. # Breaking changes # AI Usage Statement - Harness: Jcode - Model: Claude - Effort: default - Role: Found the missing capability from a DuckDB `COPY TO` failure, wrote the fix, and ran the behavior suite and the DuckDB checks above against MiniDFS. I reviewed the change and the results. -- 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]
