Skip to content

fix(services/goosefs): skip CreateDirectory when rename parent already exists - #8129

Merged
Xuanwo merged 1 commit into
apache:mainfrom
XuQianJin-Stars:fix/goosefs-skip-redundant-mkdir
Aug 23, 2026
Merged

fix(services/goosefs): skip CreateDirectory when rename parent already exists#8129
Xuanwo merged 1 commit into
apache:mainfrom
XuQianJin-Stars:fix/goosefs-skip-redundant-mkdir

Conversation

@XuQianJin-Stars

@XuQianJin-Stars XuQianJin-Stars commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Closes #.

Rationale for this change

GooseFS write-via-temp publishes with rename(tmp → final) in the same parent directory. CreateFile(recursive) on the temp path already creates that parent, but GoosefsCore::rename still called create_directory(parent, recursive) whenever the destination was missing.

The comment treated that RPC as a cheap Master no-op. Under CACHE_THROUGH, Master still sync-persists the directory to UFS, so an already-existing parent pays a full object-store round-trip (about 45–55ms in our CosN measurements; four small Lance files add ~0.19s).

flowchart TD
  start[rename tmp to final]
  stat[get_status dst]
  exists{dst exists?}
  dir{dst is directory?}
  overwrite{if_not_exists?}
  del[delete dst]
  rename1[Master rename]
  ok{rename Ok?}
  src{source still exists?}
  mkdir[create_directory parent]
  rename2[Master rename retry]
  done[done]
  fail[return error]
  cnm[ConditionNotMatch]

  start --> stat
  stat --> exists
  exists -->|yes| dir
  dir -->|yes| fail
  dir -->|no| overwrite
  overwrite -->|true| cnm
  overwrite -->|false| del --> rename1
  exists -->|NotFound| rename1
  rename1 --> ok
  ok -->|yes| done
  ok -->|NotFound| src
  src -->|no| fail
  src -->|yes| mkdir --> rename2 --> done
Loading

…y exists

CACHE_THROUGH make_directory on an existing parent is a CosN round-trip, not a metadata no-op. Create the destination parent only if Master reports it missing after rename.
@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. releases-note/fix The PR fixes a bug or has a title that begins with "fix" labels Aug 22, 2026
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Aug 23, 2026
@Xuanwo
Xuanwo merged commit 5dd49f5 into apache:main Aug 23, 2026
103 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer releases-note/fix The PR fixes a bug or has a title that begins with "fix" size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants