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
121 changes: 120 additions & 1 deletion rustfs-storage-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,10 @@ RUSTFS_CONSOLE_ENABLE=${RUSTFS_CONSOLE_ENABLE}
RUSTFS_OBS_LOGGER_LEVEL=${RUSTFS_OBS_LOGGER_LEVEL}
RUSTFS_OBS_LOG_DIRECTORY="${RUSTFS_OBS_LOG_DIRECTORY}"
EOF
if [ "${VALIDATION_SOURCE_CASE_ID}" = STOR-137 ]; then
printf '%s\n' 'RUSTFS_OBJECT_LOCK_DIAG_ENABLE=true' 'RUSTFS_OBS_LOG_STDOUT_ENABLED=true' \
'RUST_LOG=info,rustfs_ecstore::object_lock_diag=trace'
fi
if [ "${VALIDATION_CASE}" = "scanner.usage-convergence" ] || [ "${VALIDATION_CASE}" = "scanner.status-readiness" ]; then
printf 'RUSTFS_SCANNER_ENABLED=true\nRUSTFS_SCANNER_CYCLE=5\nRUSTFS_SCANNER_START_DELAY_SECS=0\n'
elif [[ "${VALIDATION_CASE}" == ilm.* ]]; then
Expand Down Expand Up @@ -571,13 +575,16 @@ validation_evidence_items() {
printf '%s\n' validation-fixture.json validation-list.json validation-baseline-usage.json validation-scanner.json validation-usage.json ;;
scanner.status-readiness)
printf '%s\n' validation-scanner-node1.json validation-scanner-node2.json validation-scanner-contract.json ;;
source-procedure.storage.stor-137)
printf '%s\n' quota-v1-ledger.json quota-v1-put-status.tsv ;;
esac
}

validation_write_result() {
local verdict="$1" reason="$2" cleanup_status="$3" item
local profile=single-4disk
if [ "${VALIDATION_SOURCE_CASE_ID}" = STOR-136 ]; then profile=single-1disk; fi
if [ "${VALIDATION_SOURCE_CASE_ID}" = STOR-137 ]; then profile="multi-4x4"; fi
if [ "${VALIDATION_CASE}" = scanner.status-readiness ] || [[ "${VALIDATION_CASE}" == ilm.* ]]; then
profile=ilm-2x4
fi
Expand Down Expand Up @@ -770,6 +777,113 @@ run_all_tests() {
run_test STOR-136 "BoundedCompressedRangeGet" test_stor136
}

quota_v1_put() {
local bucket="$1" key="$2" body="$3" sha="$4" output="$5"
curl --silent --show-error --noproxy '*' --max-time "${API_REQUEST_TIMEOUT}" \
--aws-sigv4 "aws:amz:${REGION}:s3" --user "${ACCESS_KEY}:${SECRET_KEY}" \
--header "x-amz-content-sha256: ${sha}" --upload-file "${body}" \
--dump-header "${output}.headers" --output "${output}.xml" --write-out '%{http_code}' \
"${ENDPOINT}/${bucket}/${key}" > "${output}.status"
}

quota_v1_seed() {
local bucket="$1" limit="$2" body="$3" sha="$4" output="$5" deadline
new_bucket "${bucket}" || return 1
API_ENDPOINT="${ENDPOINT}" admin_api PUT "/rustfs/admin/v3/quota/${bucket}" "" \
"{\"quota\":${limit},\"quota_type\":\"HARD\",\"reservation_protocol\":1}" >/dev/null || return 1
[ "$(admin_api_code)" = 200 ] || { echo "setting the v1 hard quota failed"; return 1; }
deadline=$((SECONDS + 90))
while [ "${SECONDS}" -lt "${deadline}" ]; do
quota_v1_put "${bucket}" seed "${body}" "${sha}" "${output}" || return 1
case "$(cat "${output}.status")" in
200) return 0 ;;
503) grep -q '<Code>SlowDown</Code>' "${output}.xml" || return 1 ;;
*) echo "seeding the v1 ledger failed with HTTP $(cat "${output}.status")"; return 1 ;;
esac
sleep 1
done
echo "v1 ledger bootstrap did not finish within 90 seconds"
return 1
}

quota_v1_ledger_events() {
local request="$1" object="$2"
jq -Rsc --arg request "${request}" --arg object "${object}" '
{request_id:$request, acquisitions:[split("\n")[] | fromjson? | select(.request_id == $request and .object == $object
and .target == "rustfs_ecstore::object_lock_diag" and .state == "acquired")
| {op, acquire_ms}]}'
}

test_stor137() {
local fixture="${TEST_TMP}/quota-v1" bucket=stor137-load hard_bucket=stor137-hard
local i pid result status cause request small_sha payload_sha started deadline elapsed successes=0
local pids=() burst_failed=0 events="${TEST_TMP}/quota-v1-ledger.json"
mkdir -p "${fixture}" || return 1
printf x > "${fixture}/byte" || return 1
make_test_file "${fixture}/payload" $((32 * 1024 * 1024)) || return 1
small_sha="$(sha256sum "${fixture}/byte" | awk '{print $1}')" || return 1
payload_sha="$(sha256sum "${fixture}/payload" | awk '{print $1}')" || return 1
quota_v1_seed "${bucket}" 17179869184 "${fixture}/byte" "${small_sha}" "${fixture}/seed" || return 1

# Use one quiet request to make the lock count independent of orphan recovery
# and use the burst to measure contention separately.
started="$(printf 'date +%%s\n' | run_remote "${NODES[0]}")" || return 1
[[ "${started}" =~ ^[0-9]+$ ]] || return 1
quota_v1_put "${bucket}" lock-count "${fixture}/byte" "${small_sha}" "${fixture}/witness" || return 1
[ "$(cat "${fixture}/witness.status")" = 200 ] || return 1
request="$(awk 'tolower($1) == "x-amz-request-id:" {sub(/\r$/, "", $2); print $2}' "${fixture}/witness.headers")"
[ -n "${request}" ] || { echo "witness response is missing its request ID"; return 1; }
deadline=$((SECONDS + 30))
while :; do
printf 'sudo -n journalctl -u rustfs --since "@%s" --no-pager -o cat\n' "${started}" |
run_remote "${NODES[0]}" |
quota_v1_ledger_events "${request}" "config/quota-ledger/${bucket}.json" > "${events}" || return 1
if jq -e '.acquisitions | map(.op) | sort == ["quota_ledger_admission", "quota_ledger_mark_commit_started", "quota_ledger_settlement"]' \
"${events}" >/dev/null; then
break
fi
if [ "${SECONDS}" -ge "${deadline}" ]; then
echo "unexpected v1 ledger acquisitions for the witness request"
cat "${events}"
return 1
fi
sleep 1
done

started=${SECONDS}
for i in {1..64}; do
quota_v1_put "${bucket}" "object-${i}" "${fixture}/payload" "${payload_sha}" "${fixture}/put-${i}" &
pids+=("$!")
done
for pid in "${pids[@]}"; do wait "${pid}" || burst_failed=1; done
elapsed=$((SECONDS - started))
result="${TEST_TMP}/quota-v1-put-status.tsv"
printf 'key\tstatus\tcause\n' > "${result}"
for i in {1..64}; do
status="$(cat "${fixture}/put-${i}.status")"
cause="$(awk 'tolower($1) == "x-rustfs-error-cause:" {sub(/\r$/, "", $2); print $2}' "${fixture}/put-${i}.headers")"
printf 'object-%s\t%s\t%s\n' "${i}" "${status}" "${cause}" >> "${result}"
case "${status}" in
200) successes=$((successes + 1)) ;;
503) ;;
*) burst_failed=1 ;;
esac
done
printf '64 concurrent PUTs in %ss, HTTP 200=%s, HTTP 503=%s\n' "${elapsed}" "${successes}" \
"$(awk -F '\t' '$2 == 503 {n++} END {print n+0}' "${result}")"
[ "${burst_failed}" -eq 0 ] && [ "${successes}" -gt 0 ] || return 1

quota_v1_seed "${hard_bucket}" 1 "${fixture}/byte" "${small_sha}" "${fixture}/hard-seed" || return 1
quota_v1_put "${hard_bucket}" denied "${fixture}/byte" "${small_sha}" "${fixture}/denied" || return 1
if [ "$(cat "${fixture}/denied.status")" != 400 ] ||
! grep -Fq 'Bucket quota exceeded. Current usage: 1 bytes, limit: 1 bytes' "${fixture}/denied.xml"; then
echo "hard quota did not reject a one-byte write above the cap"
return 1
fi
aws_run s3api list-objects-v2 --bucket "${hard_bucket}"
assert_aws_ok && jq -e '.KeyCount == 1 and .Contents[0].Key == "seed" and .Contents[0].Size == 1' <<<"${AWS_OUT}"
}

test_stor134() { # admin usage APIs must respond promptly and converge to actual object counts (#1858 #2232 #5116)
local bucket="stor134-usage" i waited code body_file apid
new_bucket "${bucket}" || return 1
Expand Down Expand Up @@ -1571,6 +1685,9 @@ main() {
fi
elif [ "${VALIDATION_SOURCE_CASE_ID}" = STOR-136 ]; then
SELECTED_TOPOLOGIES=("${TOPO_SINGLE_SINGLE}")
elif [ "${VALIDATION_SOURCE_CASE_ID}" = STOR-137 ]; then
SELECTED_TOPOLOGIES=("${TOPO_MULTI_MULTI}")
[ "${#NODES[@]}" -eq 4 ] || die "STOR-137 requires four test nodes"
else
SELECTED_TOPOLOGIES=("${TOPO_SINGLE_MULTI}")
fi
Expand Down Expand Up @@ -1619,7 +1736,9 @@ main() {
[[ "${VALIDATION_BINARY_SHA256}" =~ ^[0-9a-f]{64}$ ]] || die "installed RustFS binary SHA-256 unavailable"
fi
PASS=0; FAIL=0; UNSUPPORTED=0; FAILED_TESTS=()
if [[ "${VALIDATION_CASE}" == source-procedure.storage.* ]]; then
if [ "${VALIDATION_SOURCE_CASE_ID}" = STOR-137 ]; then
run_test STOR-137 "ConcurrentQuotaV1Put" test_stor137
elif [[ "${VALIDATION_CASE}" == source-procedure.storage.* ]]; then
run_all_tests
elif [ -n "${VALIDATION_CASE}" ]; then
case "${VALIDATION_CASE}" in
Expand Down
28 changes: 28 additions & 0 deletions validation-cases.json
Original file line number Diff line number Diff line change
Expand Up @@ -9566,6 +9566,34 @@
]
}
},
{
"id": "source-procedure.storage.stor-137",
"source_status": "procedure-ready",
"priority": "P1",
"channels": [
"s3-api",
"admin-api"
],
"assertions": [
"A warm v1 PUT on the four-node fleet acquires the bucket ledger for admission, the commit marker, and settlement exactly once each, correlated by the S3 request ID.",
"Record all response statuses and RustFS error causes from 64 concurrent single PUTs of 32 MiB each with ample quota. The burst must make progress and return only HTTP 200 or 503.",
"A separate one-byte hard quota admits exactly one byte and rejects a subsequent positive-growth PUT without publishing the second object."
],
"probes": {
"sourceCase": "STOR-137",
"executionMode": "configured-endpoint",
"runner": "rustfs-storage-test.sh",
"topology": "multi-4x4"
},
"reuse_candidates": {
"suites": [
"rustfs-storage-test.sh"
],
"case_ids": [
"STOR-137"
]
}
},
{
"id": "source-procedure.kms.kms-101",
"source_status": "procedure-ready",
Expand Down
6 changes: 3 additions & 3 deletions validation-migration-review.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"source_sha256": "463fdd02dee43e42fef4f3aacf7506709ce87af535e1a53d91c521bc2e361cad",
"reviewed_testing_commit": "5e76033d7ccad414aad1f7edb9867de6462eee43",
"scope": "Test implementation migration and candidate live acceptance are independent. This review does not rewrite original results, change migration_status semantics or relax the canonical gate. Environment procedures remain disabled by default under the accepted delivery scope.",
"evidence_basis": "20261026-canonical-migration-ledger-7094.json plus later G01/G02 attempts and source review on 2026-10-28; historical result bytes and audit reports remain in the separate evidence store. 2026-11-10: a scoped re-review of the Rebalance activity fixture, capacity admission, Started non-zero progress, and the early-completion diagnosis; this local regression adds no product live acceptance. 2026-11-22: reviewed the replication inventory pagination, Heal census completeness, expected-manifest comparison, ILM control survival, and exact marker oracles after automated review findings. Reviewed the 10-version NewerNoncurrentVersions retention procedure and source/target version-purge convergence evidence for this change. 2026-11-22: indexed the source-audit inventory and added individually dispatchable local compatibility and source-suite procedure entries with selector and candidate-admission checks. 2026-11-22: added table-catalog and upgrade procedure selectors with shared validation artifact wiring; dry-run selectors cover all 25 newly indexed procedures. 2026-11-22: clarified that source-native tests are used as assertion and boundary-value references; one-to-one native ports are outside the migration scope. 2026-11-24: re-reviewed the ILM scanner-readiness preflight after a 4-node VM run (auto-testing 644b935, RustFS 2d90297) blocked all 14 ILM cases because followers report effective_interval_available=false with a zero effective interval by design; the effective-interval comparison now runs only on the leader. This is a test-oracle correction and adds no product live acceptance. 2026-11-24: refreshed the reviewed digest for rustfs-s3-compat-test.sh to match current main (a3a9e83 and 6feeeec changed that script without updating this ledger); this PR does not modify the script, and the same digest mismatch reproduces on a clean origin/main checkout. 2026-11-24: refreshed the reviewed digest again for rustfs-s3-compat-test.sh after 90b4fe1 changed that script without updating this ledger; the main push of ba6051d failed the contract-tests job. This follow-up does not modify the script. 2026-11-24: accepted the product last_cycle_partial_reason=unknown sentinel in the ILM scanner-readiness preflight after a healthy leader was still blocked; this is a test-oracle correction and adds no product live acceptance. 2026-11-24: reviewed the new STOR-135 DeepKeyListingResilience case in rustfs-storage-test.sh (backlog#3293): a 301-segment key PUT followed by a recursive ListObjectsV2 must either return the key or fail with a controlled error while the server stays alive, and GET must return the same bytes. This is a test-oracle addition guarding the scan_dir recursion-depth fix; it adds no product live acceptance. 2026-11-25: fixed the S3C-206 fixture to send the single encoded metadata value it expects; the previous fixture sent two encoded words and the product preserved them exactly, so the case falsely failed. 2026-11-23: added strict SSE contract procedures ENC-201..ENC-210 (S3 compatibility suite) and KMS-601..KMS-609 (KMS suite), executed by scripts/sse_contract_cases.py and individually dispatchable; they were exercised against local single-process servers started with each suite's environment, which is no fleet live acceptance. 2026-11-26: indexed STOR-136 for disk-compressed Range GET on a single-node single-disk deployment, with exact response bytes and a positive bounded process read-byte delta. 2026-11-26: re-reviewed the shared scanner cycle oracle after four-node USAGE-01/20 retests. An explicitly incomplete empty response without a scan identity remains eligible for polling, published epochs use integer identifiers, and exact convergence, monotonicity, and cleanup assertions remain required. The existing migration and live acceptance states are unchanged.",
"evidence_basis": "20261026-canonical-migration-ledger-7094.json plus later G01/G02 attempts and source review on 2026-10-28; historical result bytes and audit reports remain in the separate evidence store. 2026-11-10: a scoped re-review of the Rebalance activity fixture, capacity admission, Started non-zero progress, and the early-completion diagnosis; this local regression adds no product live acceptance. 2026-11-22: reviewed the replication inventory pagination, Heal census completeness, expected-manifest comparison, ILM control survival, and exact marker oracles after automated review findings. Reviewed the 10-version NewerNoncurrentVersions retention procedure and source/target version-purge convergence evidence for this change. 2026-11-22: indexed the source-audit inventory and added individually dispatchable local compatibility and source-suite procedure entries with selector and candidate-admission checks. 2026-11-22: added table-catalog and upgrade procedure selectors with shared validation artifact wiring; dry-run selectors cover all 25 newly indexed procedures. 2026-11-22: clarified that source-native tests are used as assertion and boundary-value references; one-to-one native ports are outside the migration scope. 2026-11-24: re-reviewed the ILM scanner-readiness preflight after a 4-node VM run (auto-testing 644b935, RustFS 2d90297) blocked all 14 ILM cases because followers report effective_interval_available=false with a zero effective interval by design; the effective-interval comparison now runs only on the leader. This is a test-oracle correction and adds no product live acceptance. 2026-11-24: refreshed the reviewed digest for rustfs-s3-compat-test.sh to match current main (a3a9e83 and 6feeeec changed that script without updating this ledger); this PR does not modify the script, and the same digest mismatch reproduces on a clean origin/main checkout. 2026-11-24: refreshed the reviewed digest again for rustfs-s3-compat-test.sh after 90b4fe1 changed that script without updating this ledger; the main push of ba6051d failed the contract-tests job. This follow-up does not modify the script. 2026-11-24: accepted the product last_cycle_partial_reason=unknown sentinel in the ILM scanner-readiness preflight after a healthy leader was still blocked; this is a test-oracle correction and adds no product live acceptance. 2026-11-24: reviewed the new STOR-135 DeepKeyListingResilience case in rustfs-storage-test.sh (backlog#3293): a 301-segment key PUT followed by a recursive ListObjectsV2 must either return the key or fail with a controlled error while the server stays alive, and GET must return the same bytes. This is a test-oracle addition guarding the scan_dir recursion-depth fix; it adds no product live acceptance. 2026-11-25: fixed the S3C-206 fixture to send the single encoded metadata value it expects; the previous fixture sent two encoded words and the product preserved them exactly, so the case falsely failed. 2026-11-23: added strict SSE contract procedures ENC-201..ENC-210 (S3 compatibility suite) and KMS-601..KMS-609 (KMS suite), executed by scripts/sse_contract_cases.py and individually dispatchable; they were exercised against local single-process servers started with each suite's environment, which is no fleet live acceptance. 2026-11-26: indexed STOR-136 for disk-compressed Range GET on a single-node single-disk deployment, with exact response bytes and a positive bounded process read-byte delta. 2026-11-26: re-reviewed the shared scanner cycle oracle after four-node USAGE-01/20 retests. An explicitly incomplete empty response without a scan identity remains eligible for polling, published epochs use integer identifiers, and exact convergence, monotonicity, and cleanup assertions remain required. The existing migration and live acceptance states are unchanged. 2026-11-28: reviewed STOR-137 and its four-node selector, request-correlated quota lock oracle, concurrent response evidence, and hard-cap assertion. The dry-run and positive and negative mocked checks add no live fleet evidence.",
"reviewed_files": {
"scripts/run_validation_case.sh": "58e0eb2fb007b28fb16b0fd4a25ac2f997cc9f01a4a3700c01fe7c9a6dd1a683",
"scripts/validation_heal/authority.py": "8f2225f184427674de1f45aff4c4976c812f9d70fd4bc927ce460726a4ff74a0",
Expand Down Expand Up @@ -124,9 +124,9 @@
"rustfs-s3-compat-test.sh": "31f986f574484da43f36fcc1ee74b0a088d83574202a91945a3473b49cab82aa",
"rustfs-security-test.sh": "02cddd15636df1e74210c172ee898dba9b3adf83943da45d874d6c827583d9d2",
"rustfs-tier-test.sh": "3b37a6b26a4af862d7f2d178872900f314c8328ffd3db6a3e769928a5d1b3964",
"rustfs-storage-test.sh": "950657d31e2b9c33bc06e390f47ac166edf661573246e0900f6fa31b6a423b60",
"rustfs-storage-test.sh": "978e15585e373e763f9f1d6e9f70d4cd308c5b986a43ee53acc46cdfb0dcc829",
"rustfs-kms-test.sh": "4a20d95a04287fa4d84d1ce58e074725cd0507163eaeb6e27e0ea7fc098c3bb0",
"validation-cases.json": "07f674ae3e8eb8ca5ae77c8d85418d4755332939417999c92ae31a9603b11f66",
"validation-cases.json": "28cc251c017987c1d3d644d4600be558cc1c7fdc632c9971fc527590cce308ac",
"docs/validation-migration-map.md": "b8dd536df1f1e14324f27bbe61cb3ea796aeb3f7220876c36a828e9d80a9dffc",
"docs/source-test-migration-inventory.md": "ac434d583c69f9c2a1128e4a84eb52d9bf46395f3fe22383b2a2d5ce9a0bddd5",
"test_source_test_migration_inventory.py": "5c0122c6940ea224e7bde57fa1159536ab9ef132cf9d34517fe27c053a56b972",
Expand Down