Skip to content

HDDS-16779. FSO rename of a file to itself should be a no-op - #11440

Merged
adoroszlai merged 1 commit into
apache:masterfrom
smengcl:HDDS-16779
Oct 8, 2026
Merged

adoroszlai merged 1 commit into
apache:masterfrom
smengcl:HDDS-16779

Conversation

@smengcl

@smengcl smengcl commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Generated-by: Claude Code (Opus 5.5)

What changes were proposed in this pull request?

OMKeyRenameRequestWithFSO had an open TODO for a rename whose source and destination are the same existing file. This settles it: the request returns an OK response that changes no table. That is what the Hadoop FileSystem specification requires for rename (a file renamed to itself is a no-op and the result is true), what HDFS does for FileSystem.rename, and what the o3fs and ofs clients already return for equal paths. Renaming a directory to itself still fails with KEY_ALREADY_EXISTS. The specification leaves that result open.

The response is a DummyOMClientResponse, the existing response class that writes nothing at flush.

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-16779

How was this patch tested?

New unit tests in TestOMKeyRenameRequestWithFSO: testRenameFileToItself and testRenameDirectoryToItself. The existing rename request, rename response and double buffer unit tests pass.

Return an OK response that changes no table when source and destination are the same existing file, as the o3fs and ofs clients already do for equal paths. Renaming a directory to itself still fails with KEY_ALREADY_EXISTS.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 8, 2026 00:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused implementation matches the stated behavior and includes appropriate regression coverage.

0 open findings

What changed in this PR

Makes FSO file self-renames successful no-ops while preserving directory behavior.

Changes:

  • Returns a non-mutating successful response for file self-renames.
  • Adds file and directory self-rename tests.
File Description
OMKeyRenameRequestWithFSO.java Handles file self-renames with DummyOMClientResponse.
TestOMKeyRenameRequestWithFSO.java Verifies no-op persistence and directory rejection.

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

@github-actions github-actions Bot added the om label Oct 8, 2026
@smengcl smengcl added the bug Something isn't working label Oct 8, 2026

@adoroszlai adoroszlai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @smengcl for the patch.

@smengcl
smengcl marked this pull request as ready for review October 8, 2026 09:37
@adoroszlai
adoroszlai merged commit 1d35834 into apache:master Oct 8, 2026
63 of 65 checks passed
@smengcl

smengcl commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @adoroszlai for reviewing this

errose28 added a commit to errose28/ozone that referenced this pull request Oct 8, 2026
* master: (23 commits)
  HDDS-15951. Reduce ofs getFileChecksum to a single OM RPC (apache#11380)
  HDDS-16746. Local Stream onCommand should drain buffers before commit PutBlock (apache#11427)
  HDDS-16781. Fix intermittent ReadChunk count mismatch in TestKeyInputStream (apache#11443)
  HDDS-16779. FSO rename of a file to itself should be a no-op (apache#11440)
  HDDS-16724. Add support for missing S3 apis to STS (apache#11413)
  HDDS-16620. Expose BlockReadCursor as an iterator of streaming ReadBlock ranges (apache#11442)
  HDDS-16624. Improve AbortIncompleteMultipartUpload lifecycle validation error message (apache#11344)
  HDDS-16367. Update threat model with information about internal protocols (apache#11185)
  HDDS-16304. Convert RpcMetrics latency counters to lock-free ConcurrentMutableStat (apache#11425)
  HDDS-15681. Switch to io.github.ascopes:protobuf-maven-plugin (apache#11429)
  HDDS-16258. Refactor streaming block reads and fix checksum verification for variable-sized chunks (apache#11302)
  HDDS-16598. Fix intermittent failure in TestContainerStateMachine (apache#11319)
  HDDS-15802. Add integration tests for per-volume push replication (apache#11146)
  HDDS-16657. Reject lifecycle Transition actions in PutBucketLifecycleConfiguration (apache#11430)
  HDDS-16714. Split kubernetes check by environment (apache#11406)
  HDDS-16752. Bump guava to 33.7.2-jre (apache#11433)
  HDDS-16581. Bump ozone-runner to 20260922-1 (apache#11431)
  HDDS-16611. Use MutableGaugeLong for total count metrics in OMMetrics (apache#11410)
  HDDS-16738. Let dependabot ignore jetty minor version upgrades (apache#11422)
  HDDS-16683. Upgrade Jetty from 12.0.38 to 12.1.14 (apache#11424)
  ...

Conflicts:
hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/OzoneManagerVersion.java
hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/TestKeyValueHandler.java
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/replication/ReplicationManager.java
hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/replication/TestReplicationManager.java
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/file/OMFileCreateRequestWithFSO.java
smengcl added a commit that referenced this pull request Oct 8, 2026
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 1d35834)
smengcl added a commit that referenced this pull request Oct 8, 2026
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 1d35834)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working om

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants