Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions .github/workflows/jepsen-test-scheduled.yml
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,8 @@ jobs:
run: |
# Knossos checks each register independently. Bound each history's
# ambiguous writes while keeping the requested total write budget.
# Both write modes can accumulate enough indeterminate operations
# to exhaust Knossos at 64 writes per key.
valid_java_positive_int() {
[[ "$1" =~ ^[1-9][0-9]*$ ]] || return 1
[[ ${#1} -lt 10 ]] && return 0
Expand All @@ -340,17 +342,14 @@ jobs:
echo "key-count and max-writes-per-key must be positive 32-bit integers" >&2
exit 1
fi
FS_MAX_WRITES=$((FS_REQUESTED_WRITES < 64 ? FS_REQUESTED_WRITES : 64))
FS_KEY_COUNT=$(((FS_REQUESTED_KEYS * FS_REQUESTED_WRITES + FS_MAX_WRITES - 1) / FS_MAX_WRITES))
if (( FS_KEY_COUNT > 2147483647 )); then
echo "calculated filesystem key count exceeds the 32-bit CLI limit" >&2
exit 1
fi
echo "Filesystem register budget: ${FS_KEY_COUNT} keys, ${FS_MAX_WRITES} writes per key"
bash test/filesystem_budget_test.sh
source ./filesystem_budget.sh
declare -A RESULT
FAILED=()
for mode in overwrite rename; do
echo "::group::write-mode=${mode}"
filesystem_budget "$mode" "$FS_REQUESTED_KEYS" "$FS_REQUESTED_WRITES"
echo "Filesystem register budget: ${FS_KEY_COUNT} keys, ${FS_MAX_WRITES} writes per key"
set +e
timeout 480 ~/lein run -m elastickv.filesystem-workload --local \
--time-limit ${{ inputs.time-limit || '150' }} \
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Bound filesystem Jepsen histories by write mode

Date: 2026-10-24

## Failure

Scheduled run 40068963084 completed the filesystem `overwrite` workload, but
the `rename` workload returned `:valid? :unknown`. Eight independent register
histories reported Knossos `:cause :out-of-memory`; their final reads passed.
The existing limit of 64 writes per key did not bound the number of
indeterminate writes tightly enough for the checker. Replaying one captured
64-write history reproduced the memory failure; its first 16 writes checked
successfully.

## Change

Limit both write modes to 16 writes per key and increase key count to retain
the requested aggregate write budget. A schedule-equivalent CI replay showed
that `overwrite` can also exhaust Knossos at 64 writes per key.
Calculate each mode's budget immediately before invoking the workload.
Reject a calculated key count that exceeds the Java CLI integer limit.

The same replay found one `rename` final read that remained transiently
unavailable after the existing 32 retry attempts. Extend only final-phase
read retries to 128 attempts. Main-phase retries remain bounded at the
configured value, and a persistent final read failure still gives an unknown
or data-loss result rather than being ignored.

The checker and its register model remain unchanged, so every completed
history is still checked for linearizability. Final reads still cover every
register on every mount.

## Verification

Test the default 16-key × 250-write request in both modes, a small request
below the cap, and the integer-limit rejection. Add a final-read regression
for a read that succeeds after 32 transient EAGAIN results. Run the filesystem
Jepsen unit tests and the scheduled workflow with the new budget.

## Risk

Both default filesystem workloads initialize 250 files instead of 63 and read
them at the end. The scheduled job timeout must cover that extra work; a full
workflow run is needed to validate runtime and checker completion.
17 changes: 17 additions & 0 deletions jepsen/filesystem_budget.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash

# Sets FS_KEY_COUNT and FS_MAX_WRITES for one filesystem write mode.
filesystem_budget() {
local mode="$1" requested_keys="$2" requested_writes="$3" cap
case "$mode" in
overwrite|rename) cap=16 ;;
*) echo "unknown filesystem write mode: $mode" >&2; return 1 ;;
esac

FS_MAX_WRITES=$((requested_writes < cap ? requested_writes : cap))
FS_KEY_COUNT=$(((requested_keys * requested_writes + FS_MAX_WRITES - 1) / FS_MAX_WRITES))
if ((FS_KEY_COUNT > 2147483647)); then
echo "calculated filesystem key count exceeds the 32-bit CLI limit" >&2
return 1
fi
}
2 changes: 1 addition & 1 deletion jepsen/src/elastickv/filesystem_workload.clj
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@

(def ^:const final-read-min-retries
"Final reads run after writers stop and must outlast transient FUSE conflicts."
32)
128)

(def ^:const retry-backoff-ms 20)

Expand Down
20 changes: 20 additions & 0 deletions jepsen/test/elastickv/filesystem_workload_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,26 @@
(is (not (workload/read-retryable-error? (ex-info "mount unavailable: /mnt/fs" {}))))
(is (not (workload/read-retryable-error? (java.io.FileNotFoundException. "reg-1 (Transport endpoint is not connected)")))))

(deftest final-read-retries-after-32-transient-conflicts
(let [dir (scratch-dir)]
(try
(workload/local-setup! dir [0])
(let [attempts (atom 0)
op {:type :invoke :f :read :value (independent/tuple 0 nil) :final true}]
(with-redefs [workload/local-read
(fn [_]
(if (<= (swap! attempts inc) 32)
(throw (java.io.IOException. "Resource temporarily unavailable"))
7))]
(let [result (workload/invoke-read!
{:local? true :mount-dir dir :max-retries 8 :require-fuse-mount false}
{} "n1" op 0)]
(is (= :ok (:type result)))
(is (= (independent/tuple 0 7) (:value result)))
(is (= 33 @attempts)))))
(finally
(delete-tree! dir)))))

(deftest with-retries-accepts-a-custom-predicate
(let [calls (atom 0)]
(is (thrown? java.nio.file.NoSuchFileException
Expand Down
26 changes: 26 additions & 0 deletions jepsen/test/filesystem_budget_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash
set -euo pipefail

# shellcheck source=jepsen/filesystem_budget.sh
source "$(dirname "$0")/../filesystem_budget.sh"

filesystem_budget overwrite 16 250
[[ "$FS_KEY_COUNT" == 250 && "$FS_MAX_WRITES" == 16 ]]

# An indeterminate rename can leave many possible register states. Keep each
# Knossos history within the size that completes on the captured CI history.
filesystem_budget rename 16 250
[[ "$FS_KEY_COUNT" == 250 && "$FS_MAX_WRITES" == 16 ]]

filesystem_budget rename 3 7
[[ "$FS_KEY_COUNT" == 3 && "$FS_MAX_WRITES" == 7 ]]

if filesystem_budget rename 2147483647 2147483647 2>/dev/null; then
echo "oversized key count was accepted" >&2
exit 1
fi

if filesystem_budget unexpected 1 1 2>/dev/null; then
echo "unknown write mode was accepted" >&2
exit 1
fi
Loading