diff --git a/.github/workflows/jepsen-test-scheduled.yml b/.github/workflows/jepsen-test-scheduled.yml index 32b713803..68b577909 100644 --- a/.github/workflows/jepsen-test-scheduled.yml +++ b/.github/workflows/jepsen-test-scheduled.yml @@ -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 @@ -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' }} \ diff --git a/docs/design/2026_10_24_proposed_filesystem_jepsen_history_budget.md b/docs/design/2026_10_24_proposed_filesystem_jepsen_history_budget.md new file mode 100644 index 000000000..b66300ed5 --- /dev/null +++ b/docs/design/2026_10_24_proposed_filesystem_jepsen_history_budget.md @@ -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. diff --git a/jepsen/filesystem_budget.sh b/jepsen/filesystem_budget.sh new file mode 100644 index 000000000..4632754dd --- /dev/null +++ b/jepsen/filesystem_budget.sh @@ -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 +} diff --git a/jepsen/src/elastickv/filesystem_workload.clj b/jepsen/src/elastickv/filesystem_workload.clj index 9266ff415..9d63d2d47 100644 --- a/jepsen/src/elastickv/filesystem_workload.clj +++ b/jepsen/src/elastickv/filesystem_workload.clj @@ -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) diff --git a/jepsen/test/elastickv/filesystem_workload_test.clj b/jepsen/test/elastickv/filesystem_workload_test.clj index 9ec6b62e3..e5cdd24c6 100644 --- a/jepsen/test/elastickv/filesystem_workload_test.clj +++ b/jepsen/test/elastickv/filesystem_workload_test.clj @@ -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 diff --git a/jepsen/test/filesystem_budget_test.sh b/jepsen/test/filesystem_budget_test.sh new file mode 100644 index 000000000..a065ab820 --- /dev/null +++ b/jepsen/test/filesystem_budget_test.sh @@ -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