Skip to content

fix(decomposedfs): write arbitrary metadata in one go - #791

Merged
butonic merged 1 commit into
mainfrom
fix/atomic-arbitrary-metadata
Sep 3, 2026
Merged

butonic merged 1 commit into
mainfrom
fix/atomic-arbitrary-metadata

Conversation

@dschmidt

@dschmidt dschmidt commented Sep 3, 2026 •

Copy link
Copy Markdown

SetArbitraryMetadata looped over the metadata map and wrote one attribute per call. Each of those is a separate read-merge-write on the node's metadata plus its own PushToCache, so a set of N keys becomes N observable states. Readers (loadAttributes) take no lock and hit the cache first, so a concurrent stat can see a subset that was never written as a set.

Every single write succeeds, nothing is lost. What the loop costs is atomicity: the iteration order is Go map order, so the subset a reader can observe differs on every run.

Now built as one map and written with SetXattrsWithContext, a single SetMultiple. Also drops N-1 read-merge-write cycles per call.

No test: asserting this needs either a racing reader, which only hunts for the window, or a metadata backend injected into testhelpers.NewTestEnv, which is a bigger change than the fix.

@dschmidt
dschmidt marked this pull request as ready for review September 3, 2026 10:23
@dschmidt
dschmidt force-pushed the fix/atomic-arbitrary-metadata branch from d181129 to 117ce3f Compare September 3, 2026 10:35
@butonic
butonic merged commit b744153 into main Sep 3, 2026
18 of 19 checks passed
@butonic
butonic deleted the fix/atomic-arbitrary-metadata branch September 3, 2026 11:21
@openclouders openclouders mentioned this pull request Sep 2, 2026
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants