test(scanner): add G09 upgrade evidence runner (#7522)

* fix(replication): close the GA blocker set from backlog#2366 (#7503)

* fix(replication): close GA blockers from backlog#2366

Implements the P1 set from the pre-GA replication audit:

- Replication rule tag filters now require every And.Tag to match, replacing
  the s3s OR semantics with a local AND matcher that fails closed on a
  malformed tag.
- A replicated group membership change no longer writes the group status, so
  a membership update carrying the default Enabled status cannot silently
  re-enable a disabled group on the peer.
- A successful IAM import schedules one collapsed full-IAM snapshot per remote
  peer instead of leaving the imported entities local-only.
- A pending endpoint refresh is redriven by the heavyweight reconcile tick,
  carries its own ilm-expiry override, and no longer blocks a remove that
  drops every unacknowledged peer.
- Site metrics expose local replication failure totals and rolling windows;
  node-level counters no longer report a constructed zero.
- set/remove-remote-target notify peer metadata caches before returning, so a
  follow-up put-bucket-replication on another node sees the target.
- Adds the site-replication operations runbook, a docs index, a replication
  support boundary section, and the Replication changelog section.

* fix(site-replication): resume only a locally driven endpoint refresh

The peer-side edit handler journals a pending endpoint refresh with an empty
`remote_peers` map and commits it inside the same request through
`apply_internal_peer_edit`. The reconcile tick could not tell that journal
from the coordinator's own: with no required peers it reads as complete on
sight, so the tick committed it with `edit_state` - losing the local-name
sync - and cleared it under the request that owned it, whose commit then
reported the refresh as changed and denied the coordinator the peer
acknowledgement it was waiting for.

Resume now runs only for a journal that carries the fan-out topology. A
receiver's journal stays for the coordinator to redrive with the same
refresh id, which is the path that already recovers it.

* fix(site-replication): keep an explicit disabled group status on a snapshot

Skipping the group-status write whenever an item carries members stopped a
membership change from re-enabling a disabled group, but it also silenced the
full-IAM snapshot, which always sends members together with the sender's real
status. A peer that did not have the group yet created it through
`GroupInfo::new` - enabled - so a bootstrap, a repair, or the snapshot an IAM
import now schedules handed every member of a frozen group live access there.

The madmin wire maps an unset `groupStatus` to Enabled, so only Enabled can be
a default. Disabled is always explicit and is applied again.

* fix(site-replication): schedule the import snapshot without recording a failure

`import-iam` reused the failure-recording path to queue its full-IAM
snapshot. That raises `retry_count` on every call, so three imports - the
normal shape of a bulk migration done one archive at a time - escalated a
healthy peer to `retryStats.failed` with the scheduling note shown as
`lastError`, which is exactly the signal the runbook tells operators to
repair. A full retry queue also turned a completed import into a 503.

Scheduling now only ensures the collapsed entry exists, and a failure to
schedule is logged instead of failing the request: the entities are already
imported and the reconcile pass still closes the gap.

* fix(admin): stop reporting replication failures as retries

`retries` is the minio-go counter for redeliveries, and mc prints it as such.
Filling it with the failure count claimed a redelivery that never happens: a
failed object is not retried by an event today, it waits for the scanner heal
pass. `errors` keeps the failure counters; `retries` stays zero until there is
a real redelivery to count, and the runbook now says so.

* perf(site-replication): aggregate failure windows without cloning bucket stats

`site_metrics_snapshot` went through `get_all`, which clones every bucket's
stats, and then scanned each target's sample deque twice. That deque is
bounded only by the one-hour window, so an unreachable target under load -
the case an operator polls this endpoint for - made every
`mc admin replicate status` copy the whole backlog and hold the read lock
against the failure path while doing it.

It now folds under the read lock and takes both windows in one walk. The
`max` against the serialized `last_minute` / `last_hour` snapshots is dropped:
those are stamped onto per-bucket clones elsewhere and are always zero in this
node-local cache.

* fix(site-replication): reject a conflicting ilm-expiry override on a re-run

The commit now reads the ilm-expiry override back out of the pending refresh
journal, so a second edit that asks for a different value had it dropped while
the request still reported success. Re-running without the flag keeps pinning
the recorded value - that is the documented way to redrive a stuck refresh -
but an explicit different value is now rejected instead of ignored.

* fix(admin): do not fail a remote-target write on a peer reload error

set/remove-remote-target propagated the peer metadata reload error, so a
target that was already persisted and live on this node reported a 5xx to the
client whenever one peer could not be reached. Every S3 bucket-config write
path treats that reload as best effort and only warns; these two admin
handlers now do the same, and the reason is logged with the bucket and action.

* fix(site-replication): undo every bucket a cut-short refresh rewrote

When a remove accepted on another node clears the refresh journal mid-pass,
only the bucket holding the lock at that moment had its restored target
undone. The buckets rewritten earlier in the same pass kept a target pointing
at the removed peer whenever the remove's own cleanup had already walked past
them. The undo now covers every bucket this pass rewrote, attempting all of
them so one failure does not strand the rest.

* fix(site-replication): keep replay running while an endpoint refresh is pending

A pending endpoint refresh took the whole heavyweight pass with it, so a peer
that never came back froze IAM and bucket replay to every healthy peer too -
the stall this journal's resume path was meant to end. The refresh arm now
drains the retry queue before returning; it replays per-peer deliveries
against the endpoints currently committed in state, so it is unaffected by the
edit in flight. Bucket wiring reconciliation still waits, because it rewrites
the very targets the refresh is changing, and the runbook now says so.

* test(e2e): cover the AND semantics of a two-tag replication filter

The acceptance matrix only had a single-tag rule, which matches under both AND
and OR semantics and therefore proved nothing about the filter this fix
changed. It now also carries a two-tag `And` rule - the shape
`mc replicate add --tags "k1=v1&k2=v2"` writes - and asserts that an object
with one of the two tags is not admitted while an object with both is.

No new test function, so the nightly selection digest is unchanged.

* refactor(site-replication): fold the refresh state-change error into one constructor

The endpoint-refresh work added three `s3_error!` invocation lines, which the
s3s footprint ratchet is meant to prevent. Five copies of the same
concurrent-change error now share one constructor, so the surface nets one
line smaller than main; the baseline is retightened to match.

* fix(site-replication): report a peer whose IAM snapshot waits for a repair

An escalated snapshot entry records a deletion a snapshot cannot replay, so
only a repair settles it and the marker must survive. Scheduling an import
snapshot therefore leaves that peer's entry alone - and now says so, instead
of returning success while nothing was scheduled for it.

* docs(operations): state the group-status and escalation convergence limits

Two boundaries the fixes in this branch make load-bearing: a membership change
never carries an enable, so a group disabled on one site only has to be
re-enabled there explicitly; and a peer holding an escalated IAM entry does
not receive a scheduled snapshot, including the one a bulk import schedules,
until a repair settles it.

* fix(ci): bind performance runs to selected inputs (#7512)

* test(scanner): add G09 upgrade evidence runner

Add a reusable Linux x86_64 runner for the Scanner/Heal G09 mixed-version and rollback upgrade evidence lanes.

The helper reads the pinned previous-release asset metadata from the upgrade workflow, verifies the downloaded binary, builds the current head, runs both ignored E2E tests, and fails unless the expected G09 JSON artifacts exist.

Co-Authored-By: heihutu <heihutu@gmail.com>

Co-Authored-By: zhi22915 <qiuzgang@gmail.com>

---------

Co-authored-by: 唐小鸭 <tangtang1251@qq.com>
Co-authored-by: Zhengchao An <anzhengchao@gmail.com>
Co-authored-by: zhi22915 <qiuzgang@gmail.com>
This commit is contained in:
houseme
2026-09-08 23:38:54 +08:00
committed by GitHub
parent 929f836e40
commit 8e987ce0a6
22 changed files with 1853 additions and 37 deletions
+1
View File
@@ -51,6 +51,7 @@ their issue closes.
| `e2e-run.sh` | ci-gate | Boots a rustfs server and runs the `s3s-e2e` black-box conformance tool against it | ci.yml `e2e-tests` jobs; `docs/testing/README.md` |
| `run_ecstore_validation_suite.sh` | dev-tool | ecstore black-box validation suite (`quick`/`full`/`destructive`/`fuzz` profiles) | `docs/testing/README.md`, `docs/testing/ecstore-validation-suite-design.md` |
| `run_e2e_tests.sh` | dev-tool | Local `e2e_test` crate runner (starts a server, applies filters, cleans up) | `crates/e2e_test/README.md` |
| `run_scanner_heal_g09_upgrade_evidence.sh` | dev-tool | Runs the Scanner/Heal G09 mixed-version and rollback upgrade evidence lanes against the pinned previous Linux release binary | e2e-upgrade workflow constants; backlog#2269 |
| `run.sh` | dev-tool | Local rustfs startup wrapper | `make e2e-server`; Justfile |
| `run.ps1` | dev-tool | Windows counterpart of `run.sh` | — |
| `probe.sh` | dev-tool | Probe-style e2e run | `make probe-e2e` |
+4 -1
View File
@@ -55,8 +55,11 @@ cd "$(dirname "$0")/.."
# now reports an unreadable configuration as a plain string instead of raising
# an S3 error per arm (24 invocation lines removed from
# rustfs/src/admin/handlers/bucket_meta.rs; measured after merging the two).
# 1589 -> 1588 on 2026-09-08: the GA blocker set (rustfs/backlog#2366) added
# three invocation lines to the endpoint-refresh paths and folded the five
# copies of the concurrent-change error into one constructor, netting -1.
S3S_IMPORT_FILES_BASELINE=213
S3_ERROR_LINES_BASELINE=1589
S3_ERROR_LINES_BASELINE=1588
# ecstore-scoped ratchet (rustfs/backlog#1842): the storage engine must not
# know S3 wire/DTO types (ARCHITECTURE.md invariant 4). The S3-*consuming*
# client was extracted to crates/s3-client, where s3s usage is legitimate;
+159
View File
@@ -0,0 +1,159 @@
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
UPGRADE_WORKFLOW="${PROJECT_ROOT}/.github/workflows/e2e-upgrade.yml"
SOURCE_DIR=""
OUT_DIR=""
SKIP_BUILD="false"
usage() {
cat <<'USAGE'
Usage:
scripts/run_scanner_heal_g09_upgrade_evidence.sh [--source-dir <dir>] [--out-dir <dir>] [--skip-build]
Runs the Scanner/Heal G09 upgrade evidence lanes against the pinned previous
Linux x86_64 RustFS release used by the e2e-upgrade workflow:
- rolling mixed-version reader/writer evidence
- rollback payload replay evidence
The script builds the current PR head by default, downloads and verifies the
pinned previous release binary, runs the ignored e2e tests, and fails unless all
G09 JSON evidence artifacts are present and non-empty.
USAGE
}
die() {
echo "ERROR: $*" >&2
exit 1
}
parse_args() {
while [[ $# -gt 0 ]]; do
case "$1" in
--source-dir)
[[ $# -ge 2 ]] || die "--source-dir requires a value"
SOURCE_DIR="$2"
shift 2
;;
--out-dir)
[[ $# -ge 2 ]] || die "--out-dir requires a value"
OUT_DIR="$2"
shift 2
;;
--skip-build)
SKIP_BUILD="true"
shift
;;
-h|--help)
usage
exit 0
;;
*)
die "unknown arg: $1"
;;
esac
done
}
workflow_env_value() {
local key="$1"
awk -v key="${key}:" '$1 == key { gsub(/["'\'']/, "", $2); print $2; exit }' "$UPGRADE_WORKFLOW"
}
require_linux_x86_64() {
local kernel machine
kernel="$(uname -s)"
machine="$(uname -m)"
[[ "$kernel" == "Linux" ]] || die "G09 upgrade evidence uses the pinned Linux release binary; run this on Linux"
[[ "$machine" == "x86_64" || "$machine" == "amd64" ]] || die "G09 upgrade evidence requires x86_64/amd64"
}
source_binary_path() {
printf '%s/rustfs\n' "$SOURCE_DIR"
}
ensure_previous_release_binary() {
local version asset sha archive url binary
version="${UPGRADE_SOURCE_VERSION:-$(workflow_env_value UPGRADE_SOURCE_VERSION)}"
asset="${UPGRADE_SOURCE_ASSET:-$(workflow_env_value UPGRADE_SOURCE_ASSET)}"
sha="${UPGRADE_SOURCE_SHA256:-$(workflow_env_value UPGRADE_SOURCE_SHA256)}"
[[ -n "$version" ]] || die "UPGRADE_SOURCE_VERSION is missing"
[[ -n "$asset" ]] || die "UPGRADE_SOURCE_ASSET is missing"
[[ -n "$sha" ]] || die "UPGRADE_SOURCE_SHA256 is missing"
SOURCE_DIR="${SOURCE_DIR:-${PROJECT_ROOT}/target/scanner-heal-g09-source/${version}}"
mkdir -p "$SOURCE_DIR"
binary="$(source_binary_path)"
if [[ -x "$binary" ]]; then
return
fi
archive="${SOURCE_DIR}/${asset}"
url="https://github.com/rustfs/rustfs/releases/download/${version}/${asset}"
curl --fail --location --retry 3 --output "$archive" "$url"
echo "${sha} ${archive}" | sha256sum --check --strict
unzip -q -o "$archive" -d "$SOURCE_DIR"
chmod +x "$binary"
[[ -x "$binary" ]] || die "downloaded archive did not provide an executable rustfs binary"
}
build_current_rustfs() {
if [[ "$SKIP_BUILD" == "true" ]]; then
return
fi
"${CARGO:-cargo}" build --locked -p rustfs --bin rustfs
: > "${PROJECT_ROOT}/target/debug/rustfs.features"
}
prepare_output_dir() {
local stamp
stamp="$(date -u +%Y%m%dT%H%M%SZ)"
OUT_DIR="${OUT_DIR:-${PROJECT_ROOT}/target/scanner-heal-g09-evidence/${stamp}}"
mkdir -p "$OUT_DIR"
}
run_case() {
local artifact="$1"
local test_name="$2"
shift 2
local case_dir="${OUT_DIR}/${artifact}"
mkdir -p "$case_dir"
RUSTFS_UPGRADE_SOURCE_BINARY="$(source_binary_path)" \
RUSTFS_E2E_LOG_DIR="${OUT_DIR}/server-logs/${artifact}" \
RUSTFS_SCANNER_HEAL_G09_EVIDENCE_DIR="$case_dir" \
"${CARGO:-cargo}" test --locked -p e2e_test \
"upgrade_compatibility_test::${test_name}" \
-- --ignored --exact --nocapture
local expected
for expected in "$@"; do
[[ -s "${case_dir}/${expected}" ]] || die "missing non-empty ${artifact}/${expected}"
done
}
main() {
parse_args "$@"
[[ -f "$UPGRADE_WORKFLOW" ]] || die "missing e2e-upgrade workflow"
require_linux_x86_64
cd "$PROJECT_ROOT"
ensure_previous_release_binary
build_current_rustfs
prepare_output_dir
run_case \
"mixed-version-upgrade" \
"rolling_upgrade_from_rc2_preserves_mixed_version_contracts" \
"G09-mixed_version_reader_evidence.json" \
"G09-mixed_version_writer_evidence.json"
run_case \
"bucket-config-rollback" \
"rollback_to_previous_release_reads_current_bucket_metadata" \
"G09-rollback_payload_evidence.json"
echo "PASS: Scanner/Heal G09 upgrade evidence written under ${OUT_DIR}"
}
main "$@"
+49
View File
@@ -837,6 +837,55 @@ emit_step_result() {
self.assertIn(value, contents)
self.assertNotIn("OLD RUN EVIDENCE", contents)
def test_performance_commands_bind_runner_selection_and_preserve_failures(self) -> None:
self.prepare("performance")
source = self.source.splitlines()
job = yaml_block(source, "performance-test", 2)
runner = WorkflowSteps()
runner.directory = self.directory / "workspace with spaces"
scripts = runner.directory / "auto-testing"
scripts.mkdir(parents=True)
wrapper = scripts / "rustfs_performance_test.sh"
wrapper.write_text(f"#!{sys.executable}\nimport json, os, sys\n" +
"print(json.dumps({'args': sys.argv[1:], 'env': {key: os.environ.get(key) for key in " +
"('RUSTFS_BENCH_SCRIPT', 'RUSTFS_WARP_METHODS', 'RUSTFS_WARP_SIZES', " +
"'RUSTFS_WARP_DURATION', 'RUSTFS_WARP_CONCURRENCY', 'WARP_METHODS', " +
"'WARP_SIZES', 'WARP_DURATION', 'WARP_CONCURRENCY')}}))\n" +
"sys.exit(int(os.environ['FAKE_BENCH_EXIT']))\n")
wrapper.chmod(0o755)
runner.steps = named_steps(job)
for methods, sizes, duration, concurrency in (
("get", "1KiB", "1s", "7"), ("all", "all", "5m", "64"), ("", "", "5m", "64")
):
runner.context = {"github.workspace": str(runner.directory), "inputs.test_method": methods,
"inputs.object_size": sizes, "inputs.warp_duration || '5m'": duration,
"inputs.warp_concurrency || '64'": concurrency}
runner.env = {**self.env, "RUSTFS_BENCH_SCRIPT": "/unverified/home-script.sh",
"RUSTFS_WARP_METHODS": "put", "RUSTFS_WARP_SIZES": "64MiB",
"RUSTFS_WARP_DURATION": "99h", "RUSTFS_WARP_CONCURRENCY": "2",
"WARP_DURATION": "88h", "WARP_CONCURRENCY": "3", "WARP_METHODS": "mixed", "WARP_SIZES": "32MiB",
"LOG_FILE": str(self.directory / "suite.log")}
runner.env.update(runner.step_env(job, indent=4))
for step, number in (("Run benchmark (GET/PUT/MIXED)", "5"), ("Analyze results", "6")):
for code in (0, 42):
with self.subTest(methods=methods, sizes=sizes, step=step, exit=code):
runner.env["FAKE_BENCH_EXIT"] = str(code)
result = runner.run_step(step)
self.assertEqual(result.returncode, code, result.stderr)
invocation = json.loads(result.stdout)
expected = ["--step", number, "-y", "--log-file", runner.env["LOG_FILE"]]
self.assertEqual(invocation["args"], expected)
self.assertEqual(invocation["env"]["RUSTFS_BENCH_SCRIPT"], str(scripts / "rustfs_performance_testing.sh"))
self.assertEqual(invocation["env"]["RUSTFS_WARP_METHODS"], methods)
self.assertEqual(invocation["env"]["RUSTFS_WARP_SIZES"], sizes)
self.assertEqual(invocation["env"]["RUSTFS_WARP_DURATION"], duration)
self.assertEqual(invocation["env"]["RUSTFS_WARP_CONCURRENCY"], concurrency)
if number == "6":
self.assertEqual(invocation["env"]["WARP_METHODS"], methods)
self.assertEqual(invocation["env"]["WARP_SIZES"], sizes)
self.assertEqual(invocation["env"]["WARP_DURATION"], duration)
self.assertEqual(invocation["env"]["WARP_CONCURRENCY"], concurrency)
if __name__ == "__main__":
unittest.main()