Repository navigation
Do not report transient partial sums from waitMetrics - #14262
Closed
saintstack wants to merge 1 commit into
Closed
saintstack wants to merge 1 commit into
saintstack wants to merge 1 commit into
Conversation
waitMetrics accumulates byte-sample deltas and replies as soon as the running sum leaves [min, max]. Rewriting a sampled key reaches the waiter as two deltas, a clear (-bytes) then a set (+bytes), and the waiter can reply in between with a value that never existed at any version, for example 0 bytes for a shard that holds data. Data distribution acts on that value. With small shard sizes this caused a livelock on the system keyspace: a split move rewrote a serverKeys entry in one half, the half read as 0, DD merged the halves, the merged shard measured above the split threshold and was split again, and so on until the trace-line limit aborted the process. Seen in DDPipelineSaturation on release-7.4. Before replying out of bounds, yield so the rest of the update is applied, re-read the metrics, discard the deltas queued meanwhile, and reply only if the fresh value is still out of bounds. A wrong_shard_server queued by notifyNotReadable() during the yield still fails the request through the existing error path. Should be backported to release-8.0 and release-7.4. Backport PRs will go up only after this lands on main.
Contributor
Result of foundationdb-pr-clang-ide on Linux RHEL 9
|
Contributor
Result of foundationdb-pr on Linux RHEL 9
|
Contributor
Result of foundationdb-pr-macos-m1 on macOS 14.x
|
Contributor
Result of foundationdb-pr-clang on Linux RHEL 9
|
Contributor
Result of foundationdb-pr-clang-arm on Linux RHEL 9
|
Contributor
Author
|
Let me close this for now. The failures are in 7.4 Will reopen when branch 7.4 reopens for commits (there are few failure types for this test.... Let me land a fix at a time...) |
Contributor
Result of foundationdb-pr-cluster-tests on Linux RHEL 9
|
Contributor
Result of foundationdb-pr-macos on macOS 14.x
|
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.
DDPipelineSaturationfailure in nightlies on 7.4:waitMetricsaccumulates byte-sample deltas and replies as soon as the running sum leaves[min, max]. Rewriting a sampled key reaches the waiter as two deltas — a clear (-bytes, frombyteSampleApplyClear) followed by a set (+bytes) — and the waiter can reply between them with a value that never existed at any version, e.g. 0 bytes for a shard that holds data. The code already notes the possibility ("The changes here are possibly partial changes…").Data distribution acts on that value. In
DDPipelineSaturation, whose knobs cap shards at 40 KB (below the size of the system keyspace), it produced a livelock on[\xff, \xff\xff):[\xff, \xff\xff)(71,500 bytes > 40,000) into two ~35,750-byte halves.serverKeysentry in the right half; a boundedwaitMetricson that half replies 0.This repeated every ~0.15 s for ~2,200 s of simulated time — 12,823 merges, all with
EndingSize=35750— until the trace-line limit aborted the process (TracedTooManyLines). Instrumenting the tracker showed the 0 is transient: the next read of the same location returns 35,750.Fix
Before replying out of bounds, yield (
delay(0)) so the rest of the update is applied, re-readgetMetrics(req.keys), discard the deltas queued meanwhile, and reply only if the fresh value is still out of bounds. Otherwise keep waiting.A
wrong_shard_serverqueued bynotifyNotReadable()during the yield is caught and goes through the existing error path (the request fails withwrong_shard_server). Without that, the drain rethrows it and takes the storage server down — an earlier version of this change did exactly that.New code probe:
ShardWaitMetrics transient out-of-bounds sum discarded.Testing
fdbserver_core_test:/fdbserver/StorageMetrics/waitMetrics/ignoresTransientPartialUpdate— back-to-back clear and re-set of a sampled key must not trigger a reply; a real clear afterwards still replies 0./fdbserver/StorageMetrics/waitMetrics/notReadableWhileRevalidating— range becomes unreadable during revalidation: request fails withwrong_shard_server, the waiter does not throw.DDPipelineSaturationonly: 100,000 passed.Known limitation
update()yields everyDESIRED_UPDATE_BYTESof mutations. A clear and its re-set split across that yield could still produce a transient. Expected to be rare; not addressed here.Backports
Should be backported to
release-8.0andrelease-7.4. Backport PRs will go up only after this lands onmain.