Repository navigation
perf(inode): start each node's free-inode search in its own part of the table - #35
Merged
Merged
Conversation
…he table FindFreeSlot always returned the lowest free inode, so nodes creating files at once picked the same inode and lost ClaimSlot races: creates retried and could fail with EAGAIN, and with lock claim confirmation every collision costs a full re-claim. Each node now starts its search at a fraction of the table chosen by its registry slot and wraps around. Slots map to bit-reversed fractions (0, 1/2, 1/4, 3/4, ...), so the first few nodes start a quarter of the table or more apart. No on-disk change; a single node in slot 0 scans as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… log The root directory's create logs "inode slot collision, retry", not the ClaimSlot rollback message. Drop the cross-node read-back: concurrent directory updates can still lose an entry until lock claims are confirmed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… on failure CI run 40138038165 failed with EIO on node 1's first create. Its lock wait ended with "TIMEOUT after 3 retries": go-fuse cancels the request context when the kernel sends FUSE_INTERRUPT, which happens when the calling process gets a signal. That is not an inode collision, so the test retries such creates and counts them. On failure it logs each node's warning, error and timeout lines. Also fix the inode reuse comment in the Docker and VM scripts: new files take the first free inode from the node's start, not the lowest. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
FindFreeSlotalways returned the lowest free inode. Nodes that create files at once picked the same inode and lostClaimSlotraces, so creates retried with backoff and could fail with EAGAIN. With #29's claim confirmation, each lost race also costs a full re-claim.Now each node starts its search in its own part of the inode table and wraps around. The starting point is a fraction of the table chosen by the node's registry slot, bit-reversed so that slots 0, 1, 2, 3 start at 0, ½, ¼ and ¾. With plain
slot × 4096/64spacing, each node gets about 64 inodes before it runs into the next node's range. Bit reversal keeps the first few nodes at least a quarter of the table apart.There is no on-disk change. A single node in slot 0 scans as before.
cmd/mountpasses the slot index (one line), andinternal/lockis untouched.Two nodes creating 150 files each in one directory at once (
TestMultiNodeConcurrentCreatesDoNotCollide, .66, ext4 images):On #29, this PR removes the collisions and the EAGAIN failures and saves about 45 s. The rest of #29's cost over main (about 2m45s against 55s) is its per-claim confirmation, not collisions.
Unit tests cover the spread of the first four slots, wrap-around, and a full table that still finds every freed inode. Unit tests (
-race) pass. Integration passes in both modes (-short84/84, full 98/98) and lint is clean.The new test does not read files back from the other node. On main, a file one node created was missing on the other node in 1 of 3 runs: concurrent directory updates lose an entry when two nodes both hold the directory lock. #29 fixes that; its runs had no missing files.
🤖 Generated with Claude Code