From 3283b3f8796b02cb51c6857dd64b7dbcaa0415af Mon Sep 17 00:00:00 2001 From: bootjp Date: Sat, 24 Oct 2026 15:45:09 +0900 Subject: [PATCH 1/4] docs: Propose filesystem Jepsen history budget Signed-off-by: bootjp --- ...oposed_filesystem_jepsen_history_budget.md | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 docs/design/2026_10_24_proposed_filesystem_jepsen_history_budget.md 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..8d783ea06 --- /dev/null +++ b/docs/design/2026_10_24_proposed_filesystem_jepsen_history_budget.md @@ -0,0 +1,36 @@ +# 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 + +Keep the 64-write cap for `overwrite`. Limit `rename` to 16 writes per key +and increase its key count to retain the requested aggregate write budget. +Calculate each mode's budget immediately before invoking the workload. +Reject a calculated key count that exceeds the Java CLI integer limit. + +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. Run the filesystem Jepsen +unit tests and the scheduled workflow with the new budget. + +## Risk + +The default `rename` workload initializes 250 files instead of 63 and reads +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. From 1507ddc765bcd1e2f6a0e1987706be46f82e0b78 Mon Sep 17 00:00:00 2001 From: bootjp Date: Sat, 24 Oct 2026 15:45:40 +0900 Subject: [PATCH 2/4] jepsen: Bound rename register histories Signed-off-by: bootjp --- .github/workflows/jepsen-test-scheduled.yml | 13 +++++------ jepsen/filesystem_budget.sh | 18 ++++++++++++++ jepsen/test/filesystem_budget_test.sh | 26 +++++++++++++++++++++ 3 files changed, 50 insertions(+), 7 deletions(-) create mode 100644 jepsen/filesystem_budget.sh create mode 100644 jepsen/test/filesystem_budget_test.sh diff --git a/.github/workflows/jepsen-test-scheduled.yml b/.github/workflows/jepsen-test-scheduled.yml index 32b713803..7c97aa1bd 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. + # Rename needs a smaller cap because an indeterminate replacement + # leaves more states for Knossos to explore. 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/jepsen/filesystem_budget.sh b/jepsen/filesystem_budget.sh new file mode 100644 index 000000000..7364a82eb --- /dev/null +++ b/jepsen/filesystem_budget.sh @@ -0,0 +1,18 @@ +#!/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) cap=64 ;; + 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/test/filesystem_budget_test.sh b/jepsen/test/filesystem_budget_test.sh new file mode 100644 index 000000000..67b85c4c7 --- /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" == 63 && "$FS_MAX_WRITES" == 64 ]] + +# 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 From e14b2ccdff3832e8acad99cfd91ef91506a9fa3f Mon Sep 17 00:00:00 2001 From: bootjp Date: Sat, 24 Oct 2026 16:24:39 +0900 Subject: [PATCH 3/4] docs: Cover both filesystem modes and final read retries Signed-off-by: bootjp --- ...roposed_filesystem_jepsen_history_budget.md | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) 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 index 8d783ea06..b66300ed5 100644 --- a/docs/design/2026_10_24_proposed_filesystem_jepsen_history_budget.md +++ b/docs/design/2026_10_24_proposed_filesystem_jepsen_history_budget.md @@ -14,11 +14,18 @@ successfully. ## Change -Keep the 64-write cap for `overwrite`. Limit `rename` to 16 writes per key -and increase its key count to retain the requested aggregate write budget. +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. @@ -26,11 +33,12 @@ 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. Run the filesystem Jepsen -unit tests and the scheduled workflow with the new budget. +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 -The default `rename` workload initializes 250 files instead of 63 and reads +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. From a221d229b7aedcdc83b2063bb0e2c7373d1d45a4 Mon Sep 17 00:00:00 2001 From: bootjp Date: Sat, 24 Oct 2026 16:25:12 +0900 Subject: [PATCH 4/4] jepsen: Bound both filesystem modes and retry final reads Signed-off-by: bootjp --- .github/workflows/jepsen-test-scheduled.yml | 4 ++-- jepsen/filesystem_budget.sh | 3 +-- jepsen/src/elastickv/filesystem_workload.clj | 2 +- .../elastickv/filesystem_workload_test.clj | 20 +++++++++++++++++++ jepsen/test/filesystem_budget_test.sh | 2 +- 5 files changed, 25 insertions(+), 6 deletions(-) diff --git a/.github/workflows/jepsen-test-scheduled.yml b/.github/workflows/jepsen-test-scheduled.yml index 7c97aa1bd..68b577909 100644 --- a/.github/workflows/jepsen-test-scheduled.yml +++ b/.github/workflows/jepsen-test-scheduled.yml @@ -330,8 +330,8 @@ jobs: run: | # Knossos checks each register independently. Bound each history's # ambiguous writes while keeping the requested total write budget. - # Rename needs a smaller cap because an indeterminate replacement - # leaves more states for Knossos to explore. + # 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 diff --git a/jepsen/filesystem_budget.sh b/jepsen/filesystem_budget.sh index 7364a82eb..4632754dd 100644 --- a/jepsen/filesystem_budget.sh +++ b/jepsen/filesystem_budget.sh @@ -4,8 +4,7 @@ filesystem_budget() { local mode="$1" requested_keys="$2" requested_writes="$3" cap case "$mode" in - overwrite) cap=64 ;; - rename) cap=16 ;; + overwrite|rename) cap=16 ;; *) echo "unknown filesystem write mode: $mode" >&2; return 1 ;; esac 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 index 67b85c4c7..a065ab820 100644 --- a/jepsen/test/filesystem_budget_test.sh +++ b/jepsen/test/filesystem_budget_test.sh @@ -5,7 +5,7 @@ set -euo pipefail source "$(dirname "$0")/../filesystem_budget.sh" filesystem_budget overwrite 16 250 -[[ "$FS_KEY_COUNT" == 63 && "$FS_MAX_WRITES" == 64 ]] +[[ "$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.