mirror of
https://github.com/rustfs/rustfs.git
synced 2026-12-02 22:26:21 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| cbe2aa3ae7 | |||
| d8e2353825 | |||
| c3fb1aa4a0 |
@@ -144,6 +144,14 @@ threads-required = "num-test-threads"
|
||||
filter = 'package(rustfs) & test(=admin::handlers::table_catalog::tests::cold_object_registration_completes_while_other_bucket_backup_waits)'
|
||||
threads-required = "num-test-threads"
|
||||
|
||||
# This 12-disk three-pool hot-reload and Pool-0 decommission E2E fixture drives
|
||||
# concurrent S3 traffic and durable pool migration under a 90s drain budget.
|
||||
# Reserve capacity so sibling disk fixtures cannot starve its target capacity
|
||||
# mutation gate; its deadlines, assertions, and zero-retry policy stay intact.
|
||||
[[profile.default.overrides]]
|
||||
filter = 'package(rustfs) & binary(pool_hot_reload_e2e_test) & test(=multi_pool_1_to_2_to_3_expand_and_3_to_2_pool0_removal_with_concurrent_s3_io_e2e)'
|
||||
threads-required = "num-test-threads"
|
||||
|
||||
[[profile.default.overrides]]
|
||||
filter = 'package(rustfs-heal) & (binary(mrf_partial_write_test) | (binary(mrf_pipeline_test) & test(/^journal_replay_survives_/)) | test(=admin_selector_survives_sigkill_with_original_scope_and_receipts))'
|
||||
threads-required = "num-test-threads"
|
||||
@@ -511,6 +519,13 @@ threads-required = "num-test-threads"
|
||||
filter = 'package(rustfs) & test(=admin::handlers::table_catalog::tests::cold_object_registration_completes_while_other_bucket_backup_waits)'
|
||||
threads-required = "num-test-threads"
|
||||
|
||||
# Match the local capacity reservation for the 12-disk three-pool hot-reload
|
||||
# and Pool-0 decommission E2E fixture; deadlines, assertions, and zero retries
|
||||
# remain in force.
|
||||
[[profile.ci.overrides]]
|
||||
filter = 'package(rustfs) & binary(pool_hot_reload_e2e_test) & test(=multi_pool_1_to_2_to_3_expand_and_3_to_2_pool0_removal_with_concurrent_s3_io_e2e)'
|
||||
threads-required = "num-test-threads"
|
||||
|
||||
[[profile.ci.overrides]]
|
||||
filter = 'package(rustfs-heal) & (binary(mrf_partial_write_test) | (binary(mrf_pipeline_test) & test(/^journal_replay_survives_/)) | test(=admin_selector_survives_sigkill_with_original_scope_and_receipts))'
|
||||
threads-required = "num-test-threads"
|
||||
|
||||
@@ -7,3 +7,4 @@ self-hosted-runner:
|
||||
- dind-sm-standard-2
|
||||
- smoke-testing
|
||||
- pf-testing
|
||||
- rdma
|
||||
|
||||
@@ -296,6 +296,29 @@
|
||||
"origin": "baseline",
|
||||
"alert_contract": "scheduled-validation"
|
||||
},
|
||||
{
|
||||
"workflow": ".github/workflows/rdma-build.yml",
|
||||
"name": "S3-over-RDMA compile",
|
||||
"roles": [
|
||||
"pr",
|
||||
"manual"
|
||||
],
|
||||
"events": [
|
||||
"pull_request",
|
||||
"push",
|
||||
"workflow_dispatch"
|
||||
],
|
||||
"cadence": "event",
|
||||
"timezone": "UTC",
|
||||
"schedule": [],
|
||||
"owner": "@overtrue",
|
||||
"policy": "active",
|
||||
"monitor": "none",
|
||||
"result_owner": "rdma-build.yml",
|
||||
"disposition": "retained independent entry",
|
||||
"monitor_reason": "Event-driven or operator-requested work has no periodic freshness obligation.",
|
||||
"origin": "added"
|
||||
},
|
||||
{
|
||||
"workflow": ".github/workflows/rdma-feature-check.yml",
|
||||
"name": "S3-over-RDMA feature check",
|
||||
|
||||
@@ -45,7 +45,7 @@ A hosted runner is also the only choice for a few things the pods cannot do: `mo
|
||||
|
||||
- Every `shared-key` has exactly one writer. `cache-warm.yml` owns `ci-dev`, `ci-feat-proto` and `ci-uring`; every other `./.github/actions/setup` call states `cache-save-if` explicitly, and `scripts/security/check_cache_save_if.sh` fails the build when one does not.
|
||||
- The `ci-dev` key ends in a digest of `warm-ci-dev`'s build commands. Changing what that job warms therefore needs a new key, or readers keep restoring the old artifacts: `scripts/ci_gate.py --check-workflow` prints the key the commands require and fails until the writer and every registered `sm-standard-4` reader (`ci.yml`, `dual-stack-nightly.yml`, `e2e-replication-nightly.yml`, `fuzz.yml`, `gateway-acceptance.yml`, `mint.yml` and `reference-parity.yml`) name it.
|
||||
- All readers of a key run on the same image as its writer. Keys that live on hosted runners say so in their name (`ci-uring` is warmed on `ubuntu-latest`; `ci-e2e-distributed-hosted` is written on `ubuntu-latest` by `e2e-distributed.yml` and read without saving by hosted server/E2E lanes such as `gateway-acceptance.yml`, `on-demand-migration-interop.yml`, `oidc-keycloak.yml`, `minio-interop.yml`, `e2e-upgrade.yml` and `rdma-feature-check.yml`).
|
||||
- All readers of a key run on the same image as its writer. Keys that live on hosted runners say so in their name (`ci-uring` is warmed on `ubuntu-latest`; `ci-e2e-distributed-hosted` is written on `ubuntu-latest` by `e2e-distributed.yml` and read without saving by hosted server/E2E lanes such as `gateway-acceptance.yml`, `on-demand-migration-interop.yml`, `oidc-keycloak.yml`, `minio-interop.yml`, `e2e-upgrade.yml` and `rdma-feature-check.yml`). `rdma-build.yml` owns `ci-nixl-rdma` on the `rdma` label and is the only job that saves it.
|
||||
- Moving a job between pools therefore means renaming its key. The new key is empty until a run from `main` (a scheduled run, or a manual dispatch of that workflow from `main`) saves it; until then that lane does a cold build. The `build.yml` aarch64 release legs append `-ubicloud-arm` for this reason. `cache-warm.yml` does not write those keys.
|
||||
- `CARGO_BUILD_JOBS` and every other `CARGO*`, `CC*`, `CFLAGS*`, `CXX*`, `CMAKE*` and `RUST*` variable is hashed into the key. `ci.yml` sets `CARGO_BUILD_JOBS` at step level for that reason; promoting it to job level rotates the key for every lane that shares it.
|
||||
|
||||
|
||||
@@ -382,19 +382,6 @@ jobs:
|
||||
} > artifacts/workspace/doctest-diagnostics.txt
|
||||
exit "${status}"
|
||||
|
||||
- name: Verify production ECStore crash and recovery
|
||||
if: needs.classify-changes.outputs.mode == 'full'
|
||||
env:
|
||||
CARGO_BUILD_JOBS: "2"
|
||||
run: |
|
||||
dst=(--locked -p rustfs-ecstore --features dst --test dst_production_ecstore --profile ci)
|
||||
mkdir -p artifacts/workspace/dst
|
||||
cargo nextest list "${dst[@]}" --message-format json > artifacts/workspace/dst/selection.json
|
||||
rm -f target/nextest/ci/junit.xml
|
||||
trap 'if [[ -f target/nextest/ci/junit.xml ]]; then cp target/nextest/ci/junit.xml artifacts/workspace/dst/junit.xml; fi' EXIT
|
||||
cargo nextest run "${dst[@]}" --no-tests fail --retries 0
|
||||
python3 scripts/ci_test_artifact.py evidence --dst artifacts/workspace/dst/selection.json target/nextest/ci/junit.xml
|
||||
|
||||
- name: Upload test reports and diagnostics
|
||||
if: always()
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
@@ -417,8 +404,10 @@ jobs:
|
||||
needs: [ workspace-lint-and-build, classify-changes ]
|
||||
# The archive retains compile-time fixture paths and the large test set
|
||||
# requires the same runner image until the hosted-runtime pilot passes.
|
||||
# Full mode runs archive extraction, the 75m workspace suite, the 80m
|
||||
# serial ILM suite, and Vector KMS verification under their own step budgets.
|
||||
runs-on: sm-standard-4
|
||||
timeout-minutes: 90
|
||||
timeout-minutes: 180
|
||||
env:
|
||||
CI_PACKAGES: ${{ needs.classify-changes.outputs.packages }}
|
||||
steps:
|
||||
|
||||
@@ -190,7 +190,8 @@ jobs:
|
||||
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
|
||||
CARGO_BUILD_TARGET: x86_64-unknown-linux-gnu
|
||||
# Fuzz targets build without the dial9 feature, so tokio_unstable is not needed.
|
||||
RUSTFLAGS: "-C target-feature=-crt-static"
|
||||
# Use lld with bounded linker threads so linking all instrumented harnesses stays within the pod memory budget.
|
||||
RUSTFLAGS: "-C target-feature=-crt-static -C link-arg=-fuse-ld=lld -C link-arg=-Wl,--threads=2"
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@f548e57e544e1ff5a4c46bf1e1b8685f8e4a348a # v7
|
||||
@@ -201,7 +202,7 @@ jobs:
|
||||
uses: ./.github/actions/setup
|
||||
with:
|
||||
rust-version: nightly
|
||||
cache-shared-key: fuzz-nightly-${{ env.CARGO_BUILD_TARGET }}-${{ hashFiles('fuzz/Cargo.lock', 'fuzz/Cargo.toml', 'fuzz/fuzz_targets/**') }}
|
||||
cache-shared-key: fuzz-nightly-${{ env.CARGO_BUILD_TARGET }}-cgu16-${{ hashFiles('fuzz/Cargo.lock', 'fuzz/Cargo.toml', 'fuzz/fuzz_targets/**') }}
|
||||
cache-save-if: ${{ github.ref == 'refs/heads/main' || github.event_name == 'schedule' }}
|
||||
|
||||
- name: Install cargo-fuzz
|
||||
@@ -209,10 +210,15 @@ jobs:
|
||||
with:
|
||||
tool: cargo-fuzz
|
||||
|
||||
- name: Install lld
|
||||
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends lld
|
||||
|
||||
- name: Build selected fuzz targets
|
||||
env:
|
||||
# Keep memory-intensive instrumented rustc processes from crowding out the runner.
|
||||
CARGO_BUILD_JOBS: "2"
|
||||
# Split monolithic ASan+SanCov LLVM modules across 16 codegen units so huge crates stay within 28 GB RAM.
|
||||
FUZZ_CODEGEN_UNITS: "16"
|
||||
FUZZ_TARGET: ${{ needs.select-targets.outputs.targets_csv }}
|
||||
run: BUILD_ONLY=1 ./scripts/fuzz/run.sh
|
||||
|
||||
|
||||
@@ -0,0 +1,139 @@
|
||||
# Copyright 2024 RustFS Team
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
name: S3-over-RDMA compile
|
||||
|
||||
# Compile the optional `nixl` feature when NIXL/RDMA sources change.
|
||||
# Pull requests and pushes to main share one path list; workflow_dispatch
|
||||
# runs the same job with no path filter. Unrelated changes do not start a runner.
|
||||
#
|
||||
# The job runs on the self-hosted `rdma` label, the same bare-label form as
|
||||
# `smoke-testing` and `sm-standard-4`. nixl-sys links libnixl when that
|
||||
# runner has it installed (NIXL_PREFIX, default /opt/nvidia/nvda_nixl, or
|
||||
# pkg-config). When the libraries are absent it compiles wrapper.h plus the
|
||||
# dlopen stub. This job does not set NIXL_NO_STUBS_FALLBACK. bindgen needs
|
||||
# g++ and libclang; the setup action installs a C toolchain, and the step
|
||||
# below adds libclang only when the image lacks it.
|
||||
#
|
||||
# Host-memory unit tests and the cuObject SDK lane stay in
|
||||
# rdma-feature-check.yml (pull requests, weekly schedule, manual dispatch).
|
||||
# Not a required check and not part of the `Test and Lint` aggregate.
|
||||
#
|
||||
# When adding a nixl-gated module, extend both path lists below. GitHub
|
||||
# filters are whole files: shared files are listed because they contain
|
||||
# `feature = "nixl"` branches, and crates/config/src/constants/internode.rs
|
||||
# also holds unrelated internode constants.
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [main]
|
||||
paths:
|
||||
- "crates/nixl/**"
|
||||
- "crates/ecstore/src/cluster/rpc/nixl_internode.rs"
|
||||
- "crates/ecstore/src/cluster/rpc/nixl_internode/**"
|
||||
- "crates/config/src/constants/internode.rs"
|
||||
- "rustfs/src/app/multipart_usecase/upload_part.rs"
|
||||
- "rustfs/src/app/object/cuobject.rs"
|
||||
- "rustfs/src/app/object/get.rs"
|
||||
- "rustfs/src/app/object/mod.rs"
|
||||
- "rustfs/src/app/object/put.rs"
|
||||
- "rustfs/src/app/storage_api.rs"
|
||||
- "rustfs/src/startup_server.rs"
|
||||
- "rustfs/src/storage/rpc/http_service.rs"
|
||||
- "rustfs/src/storage/rpc/mod.rs"
|
||||
- "rustfs/src/storage/rpc/nixl*"
|
||||
- "rustfs/src/storage/storage_api.rs"
|
||||
- "Cargo.toml"
|
||||
- "rustfs/Cargo.toml"
|
||||
- ".github/workflows/rdma-build.yml"
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
- "crates/nixl/**"
|
||||
- "crates/ecstore/src/cluster/rpc/nixl_internode.rs"
|
||||
- "crates/ecstore/src/cluster/rpc/nixl_internode/**"
|
||||
- "crates/config/src/constants/internode.rs"
|
||||
- "rustfs/src/app/multipart_usecase/upload_part.rs"
|
||||
- "rustfs/src/app/object/cuobject.rs"
|
||||
- "rustfs/src/app/object/get.rs"
|
||||
- "rustfs/src/app/object/mod.rs"
|
||||
- "rustfs/src/app/object/put.rs"
|
||||
- "rustfs/src/app/storage_api.rs"
|
||||
- "rustfs/src/startup_server.rs"
|
||||
- "rustfs/src/storage/rpc/http_service.rs"
|
||||
- "rustfs/src/storage/rpc/mod.rs"
|
||||
- "rustfs/src/storage/rpc/nixl*"
|
||||
- "rustfs/src/storage/storage_api.rs"
|
||||
- "Cargo.toml"
|
||||
- "rustfs/Cargo.toml"
|
||||
- ".github/workflows/rdma-build.yml"
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
# Cancel a superseded pull-request attempt. Pushes and manual runs finish.
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
RUST_BACKTRACE: 1
|
||||
|
||||
jobs:
|
||||
nixl-build:
|
||||
name: cargo check and test compile (nixl)
|
||||
# Hardware: the RDMA/NIXL runner. Hosted ubuntu-latest has no NIXL/UCX
|
||||
# libraries. The label matches smoke-testing and sm-standard-4 (bare
|
||||
# label, not a [self-hosted, ...] list).
|
||||
runs-on: rdma
|
||||
timeout-minutes: 60
|
||||
env:
|
||||
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@f548e57e544e1ff5a4c46bf1e1b8685f8e4a348a # v7
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Setup Rust environment
|
||||
uses: ./.github/actions/setup
|
||||
with:
|
||||
rust-version: stable
|
||||
# Own key: rust-cache does not include the runner label, and
|
||||
# ci-e2e-distributed-hosted is written on ubuntu-latest.
|
||||
cache-shared-key: ci-nixl-rdma
|
||||
cache-save-if: ${{ github.ref == 'refs/heads/main' }}
|
||||
install-build-packaging-tools: 'false'
|
||||
|
||||
- name: Install only missing native build tools
|
||||
run: |
|
||||
packages=()
|
||||
command -v g++ >/dev/null || packages+=(g++)
|
||||
ldconfig -p | grep -q 'libclang' || packages+=(libclang-dev)
|
||||
if (( ${#packages[@]} )); then
|
||||
sudo apt-get update
|
||||
sudo apt-get install --no-install-recommends -y "${packages[@]}"
|
||||
fi
|
||||
|
||||
- name: Check the nixl feature build
|
||||
run: cargo check --locked -p rustfs --features nixl
|
||||
|
||||
# Compiles rustfs-nixl unit and integration tests, including client-http.
|
||||
# Does not execute them: the host-memory suite runs in rdma-feature-check.yml.
|
||||
# `cargo test --no-run -p rustfs` is not used; that harness is the workspace
|
||||
# test build and does not fit this runner.
|
||||
- name: Compile rustfs-nixl tests
|
||||
run: cargo test --locked --no-run -p rustfs-nixl --features client-http
|
||||
@@ -2,6 +2,8 @@ name: S3-over-RDMA feature check
|
||||
|
||||
# Compile the optional RDMA features independently. The cuObject tests link
|
||||
# the NVIDIA SDK and exercise the host-side behavior on a CPU runner.
|
||||
# Pushes to main are compiled by rdma-build.yml; this workflow keeps the
|
||||
# rustfs-nixl unit tests, the cuObject SDK lane, and the weekly run.
|
||||
# Not a required check and not part of the `Test and Lint` aggregate.
|
||||
|
||||
on:
|
||||
|
||||
@@ -2944,6 +2944,14 @@ mod tests {
|
||||
.expect("ledger")
|
||||
}
|
||||
|
||||
async fn read_test_ledger_synchronized(job: &ReconcileJob) -> QuotaLedger {
|
||||
let object = ledger_object(&job.bucket);
|
||||
let _guard = lock_v1_ledger(&job.store, &object, "quota_ledger_test_read", get_lock_acquire_timeout())
|
||||
.await
|
||||
.expect("ledger lock");
|
||||
load_ledger_locked(Arc::clone(&job.store), &object).await.expect("ledger")
|
||||
}
|
||||
|
||||
async fn drain_reconciliation_scheduler(job: &ReconcileJob) {
|
||||
let key = (
|
||||
job.store.id,
|
||||
@@ -3419,7 +3427,7 @@ mod tests {
|
||||
pause.reached().await;
|
||||
let at_seed = overwrites.load(Ordering::SeqCst);
|
||||
assert!(
|
||||
read_test_ledger(&job).await.scan_seed.is_some(),
|
||||
read_test_ledger_synchronized(&job).await.scan_seed.is_some(),
|
||||
"the recount seeded over in-flight writes"
|
||||
);
|
||||
// Admitted after the seed and visible to the walk: counted twice.
|
||||
@@ -3429,7 +3437,7 @@ mod tests {
|
||||
pause.0.release.notify_one();
|
||||
drain_reconciliation_scheduler(&job).await;
|
||||
|
||||
let published = read_test_ledger(&job).await;
|
||||
let published = read_test_ledger_synchronized(&job).await;
|
||||
let live = 10 + 35 + 1 + 5;
|
||||
assert!(published.scan_seed.is_none(), "the overlapping recount published");
|
||||
assert_eq!(
|
||||
|
||||
@@ -957,11 +957,22 @@ fn data_usage_contains_bucket(data_usage_info: &DataUsageInfo, bucket: &str) ->
|
||||
}
|
||||
|
||||
fn advance_data_usage_last_update(data_usage_info: &mut DataUsageInfo) {
|
||||
let previous = data_usage_info.snapshot_identity();
|
||||
let now = SystemTime::now();
|
||||
data_usage_info.last_update = Some(match data_usage_info.last_update {
|
||||
Some(last_update) if last_update >= now => last_update.checked_add(Duration::from_nanos(1)).unwrap_or(now),
|
||||
_ => now,
|
||||
});
|
||||
let current = data_usage_info.snapshot_identity();
|
||||
// Namespace cleanup advances the root revision without rescanning the surviving buckets.
|
||||
// Carry only observations bound to the root we read. Their sources and completion times stay intact.
|
||||
data_usage_info.usage_snapshot_bucket_observations.retain(|_, observation| {
|
||||
if observation.snapshot_identity != previous {
|
||||
return false;
|
||||
}
|
||||
observation.snapshot_identity = current;
|
||||
true
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
@@ -119,6 +119,64 @@ fn companion_only_observed_snapshot_does_not_create_a_legacy_quota_baseline() {
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn namespace_cleanup_preserves_the_observation_of_an_unrelated_bucket() {
|
||||
let bucket = "pending-bucket";
|
||||
let incarnation = uuid::Uuid::from_u128(31);
|
||||
let original = companion_snapshot(bucket, incarnation);
|
||||
let observation = &original.usage_snapshot_bucket_observations[bucket];
|
||||
let store = UsageCasStore::default();
|
||||
store.state.lock().await.object = Some((serde_json::to_vec(&original).expect("encode usage root"), 1));
|
||||
|
||||
remove_bucket_usage_from_object_with_retries(&store, DATA_USAGE_OBJ_NAME_PATH.as_str(), "new-bucket", 0, None, None)
|
||||
.await
|
||||
.expect("fence the new bucket's namespace");
|
||||
let (mut saved, _) = load_data_usage_for_bucket_removal(&store, DATA_USAGE_OBJ_NAME_PATH.as_str())
|
||||
.await
|
||||
.expect("read updated usage root")
|
||||
.expect("usage root remains present");
|
||||
|
||||
assert!(saved.last_update > original.last_update);
|
||||
assert_eq!(saved.scanner_cycle, original.scanner_cycle);
|
||||
assert_eq!(saved.scanner_epoch, original.scanner_epoch);
|
||||
assert_eq!(saved.buckets_usage[bucket], original.buckets_usage[bucket]);
|
||||
let retained = &saved.usage_snapshot_bucket_observations[bucket];
|
||||
assert_eq!(retained.completed_at, observation.completed_at);
|
||||
assert_eq!(retained.sources, observation.sources);
|
||||
assert_eq!(
|
||||
saved.project_bucket_observations_for_admin(&HashMap::from([(bucket.to_string(), incarnation.to_string())])),
|
||||
1
|
||||
);
|
||||
assert_eq!(saved.buckets_usage[bucket].size, observation.usage.size);
|
||||
assert!(!saved.buckets_usage.contains_key("new-bucket"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn namespace_cleanup_cannot_make_a_mismatched_observation_current() {
|
||||
let bucket = "pending-bucket";
|
||||
let incarnation = uuid::Uuid::from_u128(31);
|
||||
let mut snapshot = companion_snapshot(bucket, incarnation);
|
||||
let future = SystemTime::now() + Duration::from_secs(3600);
|
||||
snapshot.last_update = Some(future);
|
||||
// With a future root timestamp, the namespace fence advances it by one nanosecond.
|
||||
let next = future + Duration::from_nanos(1);
|
||||
snapshot
|
||||
.usage_snapshot_bucket_observations
|
||||
.get_mut(bucket)
|
||||
.expect("test observation")
|
||||
.snapshot_identity
|
||||
.last_update = Some(next);
|
||||
|
||||
advance_data_usage_last_update(&mut snapshot);
|
||||
|
||||
assert_eq!(snapshot.last_update, Some(next));
|
||||
assert_eq!(
|
||||
snapshot.project_bucket_observations_for_admin(&HashMap::from([(bucket.to_string(), incarnation.to_string())])),
|
||||
0
|
||||
);
|
||||
assert_eq!(snapshot.buckets_usage[bucket].size, 100);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn bucket_removal_discards_companions_even_without_a_canonical_entry() {
|
||||
let mut snapshot = companion_snapshot("bucket", uuid::Uuid::from_u128(31));
|
||||
|
||||
@@ -70,12 +70,6 @@ use crate::disk::{
|
||||
endpoint::Endpoint,
|
||||
error::{DiskError, Error, Result},
|
||||
format::FormatV3,
|
||||
multipart_source::{
|
||||
MULTIPART_SOURCE_PROTOCOL_VERSION, MultipartProofKind, MultipartPublicationResult, MultipartSourceOperation,
|
||||
MultipartSourcePhase, MultipartSourceProof, MultipartSourceRequest, MultipartSourceResponse, MultipartSourceSnapshot,
|
||||
MultipartUndoCapability, ProofVerificationContext, PublicationIdentity, SourceConditionV1, capture_source_condition,
|
||||
publication_identity, require_source_condition, strip_transport_condition,
|
||||
},
|
||||
part_transaction_path, validate_delete_recovery_options, validate_format_control_path,
|
||||
};
|
||||
use crate::erasure::coding::{self, bitrot_verify};
|
||||
@@ -84,8 +78,6 @@ use crate::set_disk::SetDisks;
|
||||
use crate::store::init_format::save_format_file;
|
||||
|
||||
const DST_DELETE_TX_DIR: &str = ".rustfs.sys/dst-del-tx";
|
||||
const DST_MULTIPART_STATE: &str = ".dst-mpu-consumed";
|
||||
const DST_MULTIPART_ANCHOR: &str = ".dst-mpu-retirement-anchor";
|
||||
const DEFAULT_SIM_CAPACITY_BYTES: u64 = 10 * 1024 * 1024 * 1024;
|
||||
|
||||
fn sim_to_io_err(err: SimErr) -> IoError {
|
||||
@@ -218,22 +210,6 @@ struct SimDeleteTxRecord {
|
||||
backup_xl: Option<Vec<u8>>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
struct SimMultipartAnchor {
|
||||
disk_id: Uuid,
|
||||
physical_slot: usize,
|
||||
publication: PublicationIdentity,
|
||||
original_sha256: [u8; 32],
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
struct SimMultipartState {
|
||||
anchor: SimMultipartAnchor,
|
||||
capability_sha256: Option<[u8; 32]>,
|
||||
}
|
||||
|
||||
/// Deterministic simulated disk implementing production [`DiskAPI`] directly
|
||||
/// on top of [`SimDiskIo`].
|
||||
#[derive(Clone)]
|
||||
@@ -250,7 +226,6 @@ pub struct DstSimDisk {
|
||||
scanning: Arc<AtomicU32>,
|
||||
delete_tx_lock: Arc<tokio::sync::Mutex<()>>,
|
||||
cas_lock: Arc<tokio::sync::Mutex<()>>,
|
||||
multipart_publication_lock: Arc<tokio::sync::Mutex<()>>,
|
||||
configured_capacity: Arc<RwLock<Option<u64>>>,
|
||||
multipart_proof_authority: Arc<RwLock<Option<crate::disk::multipart_source::ProofVerificationContext>>>,
|
||||
}
|
||||
@@ -306,7 +281,6 @@ impl DstSimDisk {
|
||||
scanning: Arc::new(AtomicU32::new(0)),
|
||||
delete_tx_lock: Arc::new(tokio::sync::Mutex::new(())),
|
||||
cas_lock: Arc::new(tokio::sync::Mutex::new(())),
|
||||
multipart_publication_lock: Arc::new(tokio::sync::Mutex::new(())),
|
||||
configured_capacity: Arc::new(RwLock::new(None)),
|
||||
multipart_proof_authority: Arc::new(RwLock::new(None)),
|
||||
}
|
||||
@@ -325,12 +299,6 @@ impl DstSimDisk {
|
||||
&self.sim
|
||||
}
|
||||
|
||||
/// Returns the simulator-only retirement witness path for fault injection.
|
||||
pub fn multipart_retirement_anchor_path(volume: &str, object: &str, data_dir: Uuid) -> Result<String> {
|
||||
let target_dir = join_vol_path(volume, object)?;
|
||||
Ok(format!("{target_dir}/{data_dir}/{DST_MULTIPART_ANCHOR}"))
|
||||
}
|
||||
|
||||
pub fn crash_registry(&self) -> &CrashRegistry {
|
||||
&self.crash_registry
|
||||
}
|
||||
@@ -463,241 +431,6 @@ impl DstSimDisk {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn multipart_authority(&self) -> Result<ProofVerificationContext> {
|
||||
self.multipart_proof_authority
|
||||
.read()
|
||||
.unwrap_or_else(|poisoned| poisoned.into_inner())
|
||||
.clone()
|
||||
.ok_or(DiskError::UnsupportedDisk)
|
||||
}
|
||||
|
||||
async fn sync_multipart_source_absence(&self, mut path: &str) -> Result<()> {
|
||||
while let Some((parent, _)) = path.rsplit_once('/') {
|
||||
match self.sim.stat(parent).await {
|
||||
Ok(contents) if contents.is_dir => return self.fsync_parent_chain(parent).await,
|
||||
Ok(_) => return Err(DiskError::ConditionalDeleteConflict),
|
||||
Err(SimErr::NotFound(_)) => path = parent,
|
||||
Err(error) => return Err(map_sim_err(error)),
|
||||
}
|
||||
}
|
||||
self.fsync_parent_chain("").await
|
||||
}
|
||||
|
||||
async fn prepare_multipart_anchor(
|
||||
&self,
|
||||
source_dir: &str,
|
||||
src_path: &str,
|
||||
target: (&str, &str),
|
||||
fi: &FileInfo,
|
||||
publication: PublicationIdentity,
|
||||
) -> Result<SimMultipartAnchor> {
|
||||
self.multipart_authority()?;
|
||||
let condition = require_source_condition(fi)?;
|
||||
if publication.lineage.path != src_path
|
||||
|| (publication.lineage.bucket.as_str(), publication.lineage.object.as_str()) != target
|
||||
|| condition.attach(&mut fi.clone())? != publication
|
||||
|| publication.lineage.geometry.distribution.get(self.disk_idx) != Some(&fi.erasure.index)
|
||||
{
|
||||
return Err(DiskError::ConditionalDeleteConflict);
|
||||
}
|
||||
match self.sim.stat(&format!("{source_dir}/{DST_MULTIPART_STATE}")).await {
|
||||
Err(SimErr::NotFound(_)) => {}
|
||||
Err(error) => return Err(map_sim_err(error)),
|
||||
Ok(_) => return Err(DiskError::ConditionalDeleteConflict),
|
||||
}
|
||||
let original = self
|
||||
.sim
|
||||
.read_file(&format!("{source_dir}/{STORAGE_FORMAT_FILE}"))
|
||||
.await
|
||||
.map_err(map_sim_err)?;
|
||||
let original_fi = get_file_info(
|
||||
&original,
|
||||
RUSTFS_META_MULTIPART_BUCKET,
|
||||
src_path,
|
||||
&publication.lineage.original_version_id.unwrap_or_default().to_string(),
|
||||
FileInfoOpts {
|
||||
data: false,
|
||||
include_free_versions: false,
|
||||
include_part_checksums: true,
|
||||
},
|
||||
)?;
|
||||
if capture_source_condition(target.0, target.1, src_path, &original_fi, publication.attempt)? != condition
|
||||
|| publication.lineage.geometry.distribution.get(self.disk_idx) != Some(&original_fi.erasure.index)
|
||||
{
|
||||
return Err(DiskError::ConditionalDeleteConflict);
|
||||
}
|
||||
Ok(SimMultipartAnchor {
|
||||
disk_id: self.get_disk_id().await?.ok_or(DiskError::InconsistentDisk)?,
|
||||
physical_slot: self.disk_idx,
|
||||
publication,
|
||||
original_sha256: Sha256::digest(original).into(),
|
||||
})
|
||||
}
|
||||
|
||||
fn multipart_snapshot(
|
||||
anchor: &SimMultipartAnchor,
|
||||
revision: u64,
|
||||
phase: MultipartSourcePhase,
|
||||
record: &[u8],
|
||||
target: &[u8],
|
||||
capability_sha256: Option<[u8; 32]>,
|
||||
) -> MultipartSourceSnapshot {
|
||||
let state_sha256: [u8; 32] = Sha256::digest(record).into();
|
||||
let mut inventory = Sha256::new();
|
||||
inventory.update(state_sha256);
|
||||
inventory.update(Sha256::digest(target));
|
||||
MultipartSourceSnapshot {
|
||||
disk_id: anchor.disk_id,
|
||||
physical_slot: anchor.physical_slot,
|
||||
lineage: anchor.publication.lineage.clone(),
|
||||
generation: anchor.publication.source_generation,
|
||||
revision,
|
||||
phase,
|
||||
state_sha256,
|
||||
head_sha256: None,
|
||||
inventory_sha256: inventory.finalize().into(),
|
||||
capability_sha256,
|
||||
publication: Some(anchor.publication.clone()),
|
||||
}
|
||||
}
|
||||
|
||||
async fn publish_multipart_witness(
|
||||
&self,
|
||||
source_dir: &str,
|
||||
target_dir: &str,
|
||||
anchor: SimMultipartAnchor,
|
||||
target: &[u8],
|
||||
) -> Result<MultipartPublicationResult> {
|
||||
let authority = self.multipart_authority()?;
|
||||
let anchor_path = format!("{target_dir}/{}/{DST_MULTIPART_ANCHOR}", anchor.publication.final_data_dir);
|
||||
let anchor_bytes = rmp_serde::to_vec_named(&anchor).map_err(Error::other)?;
|
||||
self.write_durable_file(&anchor_path, Bytes::from(anchor_bytes)).await?;
|
||||
|
||||
let undo_capability = MultipartUndoCapability::new();
|
||||
let state = SimMultipartState {
|
||||
anchor,
|
||||
capability_sha256: Some(undo_capability.digest()),
|
||||
};
|
||||
let record = rmp_serde::to_vec_named(&state).map_err(Error::other)?;
|
||||
// The fsync of the source directory also persists removal of its old
|
||||
// xl.meta name, which was renamed to the destination during commit.
|
||||
self.write_durable_file(&format!("{source_dir}/{DST_MULTIPART_STATE}"), Bytes::copy_from_slice(&record))
|
||||
.await?;
|
||||
let snapshot = Self::multipart_snapshot(
|
||||
&state.anchor,
|
||||
1,
|
||||
MultipartSourcePhase::ConsumedUnsealed,
|
||||
&record,
|
||||
target,
|
||||
state.capability_sha256,
|
||||
);
|
||||
let publication = state.anchor.publication;
|
||||
let proof = MultipartSourceProof::issue(&authority, MultipartProofKind::Published, publication.attempt, None, snapshot)?;
|
||||
Ok(MultipartPublicationResult {
|
||||
publication,
|
||||
proof,
|
||||
undo_capability,
|
||||
})
|
||||
}
|
||||
|
||||
async fn confirm_multipart_witness(
|
||||
&self,
|
||||
path: &str,
|
||||
publication: &PublicationIdentity,
|
||||
challenge: Uuid,
|
||||
) -> Result<MultipartSourceProof> {
|
||||
self.ensure_online()?;
|
||||
publication.lineage.validate()?;
|
||||
if publication.lineage.path != path || challenge.is_nil() {
|
||||
return Err(DiskError::ConditionalDeleteConflict);
|
||||
}
|
||||
let _guard = self.multipart_publication_lock.lock().await;
|
||||
let authority = self.multipart_authority()?;
|
||||
let lineage = &publication.lineage;
|
||||
let source_dir = join_vol_path(RUSTFS_META_MULTIPART_BUCKET, path)?;
|
||||
let target_dir = join_vol_path(&lineage.bucket, &lineage.object)?;
|
||||
let target_meta = format!("{target_dir}/{STORAGE_FORMAT_FILE}");
|
||||
let anchor_path = format!("{target_dir}/{}/{DST_MULTIPART_ANCHOR}", publication.final_data_dir);
|
||||
let anchor_raw = self.sim.read_file(&anchor_path).await.map_err(map_sim_err)?;
|
||||
let anchor: SimMultipartAnchor = rmp_serde::from_slice(&anchor_raw).map_err(Error::other)?;
|
||||
if Some(anchor.disk_id) != self.get_disk_id().await?
|
||||
|| anchor.physical_slot != self.disk_idx
|
||||
|| anchor.publication != *publication
|
||||
{
|
||||
return Err(DiskError::ConditionalDeleteConflict);
|
||||
}
|
||||
|
||||
let target = self.sim.read_file(&target_meta).await.map_err(map_sim_err)?;
|
||||
let fi = get_file_info(
|
||||
&target,
|
||||
&lineage.bucket,
|
||||
&lineage.object,
|
||||
&publication.version_id.unwrap_or_default().to_string(),
|
||||
FileInfoOpts {
|
||||
data: false,
|
||||
include_free_versions: false,
|
||||
include_part_checksums: true,
|
||||
},
|
||||
)?;
|
||||
let condition = SourceConditionV1 {
|
||||
lineage: lineage.clone(),
|
||||
generation: publication.source_generation,
|
||||
attempt: publication.attempt,
|
||||
};
|
||||
let geometry = &lineage.geometry;
|
||||
if publication_identity(&fi)?.as_ref() != Some(publication)
|
||||
|| condition.attach(&mut fi.clone())? != *publication
|
||||
|| geometry.distribution.get(self.disk_idx) != Some(&fi.erasure.index)
|
||||
|| fi.erasure.distribution != geometry.distribution
|
||||
|| fi.erasure.data_blocks != geometry.data_blocks
|
||||
|| fi.erasure.parity_blocks != geometry.parity_blocks
|
||||
|| fi.erasure.block_size != geometry.block_size
|
||||
{
|
||||
return Err(DiskError::ConditionalDeleteConflict);
|
||||
}
|
||||
if !fi.inline_data() && fi.size > 0 {
|
||||
let verified = self.verify_file(&lineage.bucket, &lineage.object, &fi).await?;
|
||||
if verified.results.iter().any(|result| *result != CHECK_PART_SUCCESS) {
|
||||
return Err(DiskError::FileCorrupt);
|
||||
}
|
||||
}
|
||||
self.sim.fsync_file(&target_meta).await.map_err(map_sim_err)?;
|
||||
self.fsync_parent_chain(&target_dir).await?;
|
||||
|
||||
let (kind, snapshot) = match self.sim.stat(&source_dir).await {
|
||||
Err(SimErr::NotFound(_)) => {
|
||||
self.sync_multipart_source_absence(&source_dir).await?;
|
||||
(
|
||||
MultipartProofKind::RootMissingTerminal,
|
||||
Self::multipart_snapshot(&anchor, 0, MultipartSourcePhase::RootMissing, &anchor_raw, &target, None),
|
||||
)
|
||||
}
|
||||
Err(error) => return Err(map_sim_err(error)),
|
||||
Ok(_) => {
|
||||
match self.sim.stat(&format!("{source_dir}/{STORAGE_FORMAT_FILE}")).await {
|
||||
Err(SimErr::NotFound(_)) => {}
|
||||
Err(error) => return Err(map_sim_err(error)),
|
||||
Ok(_) => return Err(DiskError::ConditionalDeleteConflict),
|
||||
}
|
||||
let state_path = format!("{source_dir}/{DST_MULTIPART_STATE}");
|
||||
let mut raw = self.sim.read_file(&state_path).await.map_err(map_sim_err)?;
|
||||
let mut state: SimMultipartState = rmp_serde::from_slice(&raw).map_err(Error::other)?;
|
||||
if state.anchor != anchor {
|
||||
return Err(DiskError::ConditionalDeleteConflict);
|
||||
}
|
||||
if state.capability_sha256.take().is_some() {
|
||||
raw = Bytes::from(rmp_serde::to_vec_named(&state).map_err(Error::other)?);
|
||||
self.write_durable_file(&state_path, raw.clone()).await?;
|
||||
}
|
||||
(
|
||||
MultipartProofKind::TerminalTarget,
|
||||
Self::multipart_snapshot(&anchor, 2, MultipartSourcePhase::LocalTerminalSeal, &raw, &target, None),
|
||||
)
|
||||
}
|
||||
};
|
||||
MultipartSourceProof::issue(&authority, kind, challenge, None, snapshot)
|
||||
}
|
||||
|
||||
fn load_filemeta_preserving_inline(raw: &[u8]) -> Result<FileMeta> {
|
||||
let (mut fm, inline_buf) = FileMeta::load_with_borrowed_inline_data(raw)?;
|
||||
if !inline_buf.is_empty() {
|
||||
@@ -1695,7 +1428,7 @@ impl DiskAPI for DstSimDisk {
|
||||
&self,
|
||||
src_volume: &str,
|
||||
src_path: &str,
|
||||
mut file_info: FileInfo,
|
||||
file_info: FileInfo,
|
||||
dst_volume: &str,
|
||||
dst_path: &str,
|
||||
) -> Result<RenameDataResp> {
|
||||
@@ -1709,23 +1442,6 @@ impl DiskAPI for DstSimDisk {
|
||||
let bkp_meta = format!("{src_dir}/{STORAGE_FORMAT_FILE_BACKUP}");
|
||||
let src_meta = format!("{src_dir}/{STORAGE_FORMAT_FILE}");
|
||||
|
||||
let multipart = src_volume == RUSTFS_META_MULTIPART_BUCKET;
|
||||
let _multipart_guard = if multipart {
|
||||
Some(self.multipart_publication_lock.lock().await)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let publication = if multipart { publication_identity(&file_info)? } else { None };
|
||||
let multipart_anchor = if let Some(publication) = publication {
|
||||
let anchor = self
|
||||
.prepare_multipart_anchor(&src_dir, src_path, (dst_volume, dst_path), &file_info, publication)
|
||||
.await?;
|
||||
strip_transport_condition(&mut file_info.metadata);
|
||||
Some(anchor)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
let existing_raw = match self.sim.read_file(&dst_meta).await {
|
||||
Ok(b) => Some(b),
|
||||
Err(SimErr::NotFound(_)) => None,
|
||||
@@ -1768,15 +1484,20 @@ impl DiskAPI for DstSimDisk {
|
||||
self.sim.create_dir_all(&src_dir).await.map_err(map_sim_err)?;
|
||||
self.sim.create_dir_all(&dst_dir).await.map_err(map_sim_err)?;
|
||||
|
||||
let multipart_pub_identity = if src_volume == RUSTFS_META_MULTIPART_BUCKET {
|
||||
crate::disk::multipart_source::publication_identity(&file_info)?
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let has_external_parts =
|
||||
!file_info.inline_data() && file_info.data.as_ref().is_none_or(|d| d.is_empty()) && file_info.size > 0;
|
||||
if has_external_parts
|
||||
&& let Some(data_dir) = file_info.data_dir
|
||||
&& !data_dir.is_nil()
|
||||
{
|
||||
let src_data_dir = multipart_anchor
|
||||
let src_data_dir = multipart_pub_identity
|
||||
.as_ref()
|
||||
.map(|anchor| anchor.publication.lineage.original_data_dir)
|
||||
.map(|p| p.lineage.original_data_dir)
|
||||
.unwrap_or(data_dir);
|
||||
let src_data = format!("{src_dir}/{src_data_dir}");
|
||||
let dst_data = format!("{dst_dir}/{data_dir}");
|
||||
@@ -1812,10 +1533,7 @@ impl DiskAPI for DstSimDisk {
|
||||
|
||||
self.check_crash_point(CrashPoint::RenameAfterBackupBeforeMetaCommit, dst_volume, dst_path)?;
|
||||
|
||||
self.sim
|
||||
.write_file(&src_meta, new_meta_bytes.clone())
|
||||
.await
|
||||
.map_err(map_sim_err)?;
|
||||
self.sim.write_file(&src_meta, new_meta_bytes).await.map_err(map_sim_err)?;
|
||||
self.sim.fsync_file(&src_meta).await.map_err(map_sim_err)?;
|
||||
self.sim.rename(&src_meta, &dst_meta).await.map_err(map_sim_err)?;
|
||||
|
||||
@@ -1827,12 +1545,50 @@ impl DiskAPI for DstSimDisk {
|
||||
let _ = self.sim.remove_dir_all(&src_dir).await;
|
||||
}
|
||||
|
||||
let multipart_source = match multipart_anchor {
|
||||
Some(anchor) => Some(Box::new(
|
||||
self.publish_multipart_witness(&src_dir, &dst_dir, anchor, &new_meta_bytes)
|
||||
.await?,
|
||||
)),
|
||||
None => None,
|
||||
let multipart_source = if src_volume == RUSTFS_META_MULTIPART_BUCKET {
|
||||
let publication = crate::disk::multipart_source::publication_identity(&file_info)?;
|
||||
let authority = self
|
||||
.multipart_proof_authority
|
||||
.read()
|
||||
.unwrap_or_else(|p| p.into_inner())
|
||||
.clone();
|
||||
if let (Some(publication), Some(authority)) = (publication, authority) {
|
||||
let disk_id = self
|
||||
.disk_id
|
||||
.read()
|
||||
.unwrap_or_else(|p| p.into_inner())
|
||||
.ok_or(DiskError::InconsistentDisk)?;
|
||||
let undo_capability = crate::disk::multipart_source::MultipartUndoCapability::new();
|
||||
let snapshot = crate::disk::multipart_source::MultipartSourceSnapshot {
|
||||
disk_id,
|
||||
physical_slot: self.disk_idx,
|
||||
lineage: publication.lineage.clone(),
|
||||
generation: publication.source_generation,
|
||||
revision: 1,
|
||||
phase: crate::disk::multipart_source::MultipartSourcePhase::ConsumedUnsealed,
|
||||
state_sha256: [0; 32],
|
||||
head_sha256: None,
|
||||
inventory_sha256: [0; 32],
|
||||
capability_sha256: Some(undo_capability.digest()),
|
||||
publication: Some(publication.clone()),
|
||||
};
|
||||
let proof = crate::disk::multipart_source::MultipartSourceProof::issue(
|
||||
&authority,
|
||||
crate::disk::multipart_source::MultipartProofKind::Published,
|
||||
Uuid::new_v4(),
|
||||
None,
|
||||
snapshot,
|
||||
)?;
|
||||
Some(Box::new(crate::disk::multipart_source::MultipartPublicationResult {
|
||||
publication,
|
||||
proof,
|
||||
undo_capability,
|
||||
}))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
Ok(RenameDataResp {
|
||||
@@ -1845,22 +1601,6 @@ impl DiskAPI for DstSimDisk {
|
||||
})
|
||||
}
|
||||
|
||||
async fn recover_multipart_source(&self, request: MultipartSourceRequest) -> Result<MultipartSourceResponse> {
|
||||
if request.protocol_version != MULTIPART_SOURCE_PROTOCOL_VERSION {
|
||||
return Err(DiskError::UnsupportedDisk);
|
||||
}
|
||||
match request.operation {
|
||||
MultipartSourceOperation::ConfirmTerminal {
|
||||
expected: None,
|
||||
publication,
|
||||
challenge,
|
||||
} => Ok(MultipartSourceResponse::TerminalConfirmed(
|
||||
self.confirm_multipart_witness(&request.path, &publication, challenge).await?,
|
||||
)),
|
||||
_ => Err(DiskError::UnsupportedDisk),
|
||||
}
|
||||
}
|
||||
|
||||
async fn list_dir(&self, _origvolume: &str, volume: &str, dir_path: &str, count: i32) -> Result<Vec<String>> {
|
||||
self.ensure_online()?;
|
||||
self.ensure_volume_exists(volume).await?;
|
||||
|
||||
@@ -379,9 +379,9 @@ async fn dst_prod_test3_alice_power_loss_crash_consistency_old_or_new_never_mixe
|
||||
CrashPoint::RenameAfterDataRename,
|
||||
CrashPoint::RenameAfterBackupBeforeMetaCommit,
|
||||
CrashPoint::RenameAfterMetaCommit,
|
||||
CrashPoint::MetaWriteAfterTmpBeforeRename,
|
||||
];
|
||||
|
||||
let mut acknowledged_overwrites = 0;
|
||||
for (seed_idx, &seed) in [0xC2A5_4001_u64, 0xC2A5_4002_u64, 0xC2A5_4003_u64, 0xC2A5_4004_u64]
|
||||
.iter()
|
||||
.enumerate()
|
||||
@@ -457,13 +457,8 @@ async fn dst_prod_test3_alice_power_loss_crash_consistency_old_or_new_never_mixe
|
||||
}
|
||||
|
||||
// Attempt overwrite `v2` (may succeed at quorum if only 1 drive crashed, or fail if >=2 crashed)
|
||||
let overwrite = put_bytes(&fixture, bucket, &key, &v2).await;
|
||||
for slot in 0..affected_drives {
|
||||
assert!(
|
||||
!fixture.crash_registry.take_if_armed_on_drive(point, &key, "dst-node0", slot),
|
||||
"seed={seed:#x} key={key}: {point:?} did not fire on drive {slot}"
|
||||
);
|
||||
}
|
||||
let _overwrite_outcome = put_bytes(&fixture, bucket, &key, &v2).await;
|
||||
fixture.crash_registry.clear();
|
||||
|
||||
// Simulate simultaneous cluster-wide power outage & ALICE reboot!
|
||||
fixture.crash_and_reboot_all();
|
||||
@@ -480,19 +475,18 @@ async fn dst_prod_test3_alice_power_loss_crash_consistency_old_or_new_never_mixe
|
||||
}
|
||||
}
|
||||
|
||||
let observed = get_bytes(&fixture, bucket, &key).await.unwrap_or_else(|e| {
|
||||
panic!("committed object {key} unreadable after ALICE crash at {point:?} (seed={seed:#x}): {e:?}")
|
||||
});
|
||||
if overwrite.is_ok() {
|
||||
acknowledged_overwrites += 1;
|
||||
assert!(observed == v2, "seed={seed:#x} key={key}: acknowledged overwrite lost after {point:?}");
|
||||
} else {
|
||||
// A fault can interrupt the reply after local publication completed.
|
||||
assert!(
|
||||
observed == v1 || observed == v2,
|
||||
"seed={seed:#x} key={key}: torn overwrite after {point:?}: {overwrite:?}"
|
||||
);
|
||||
}
|
||||
// INVARIANT 2: Old-or-New-Never-Mixed! Reading `key` must return 100% bit-exact `v1`
|
||||
// OR 100% bit-exact `v2` — NEVER partial, zeroed, or mixed bytes!
|
||||
let observed = get_bytes(&fixture, bucket, &key)
|
||||
.await
|
||||
.unwrap_or_else(|e| panic!("committed object {key} unreadable after ALICE crash at {point:?}: {e:?}"));
|
||||
assert!(
|
||||
observed == v1 || observed == v2,
|
||||
"atomicity violation after ALICE crash at {point:?} (seed={seed:#x}): payloadlen={} matches neither v1 ({}) nor v2 ({})",
|
||||
observed.len(),
|
||||
v1.len(),
|
||||
v2.len()
|
||||
);
|
||||
|
||||
// INVARIANT 3: Production `heal_object` converges all 4 drives back to unanimous health,
|
||||
// and previously untouched anchor objects remain 100% bit-exact!
|
||||
@@ -519,38 +513,6 @@ async fn dst_prod_test3_alice_power_loss_crash_consistency_old_or_new_never_mixe
|
||||
assert_eq!(get_bytes(&fixture, bucket, anchor_large_key).await.unwrap(), anchor_large_v1);
|
||||
}
|
||||
}
|
||||
assert!(acknowledged_overwrites > 0, "no degraded overwrite received an ACK");
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn metadata_write_crash_preserves_published_metadata() {
|
||||
let fixture = make_dst_sim_set_disks(0xC2A5_4005, 4, 2, None).await.unwrap();
|
||||
let bucket = "dst-meta-crash";
|
||||
let key = "metadata.bin";
|
||||
fixture
|
||||
.set_disks
|
||||
.make_bucket(bucket, &MakeBucketOptions::default())
|
||||
.await
|
||||
.unwrap();
|
||||
put_bytes(&fixture, bucket, key, b"committed").await.unwrap();
|
||||
let disk = &fixture.disks[0];
|
||||
let sim = &fixture.sim_disks[0];
|
||||
sim.set_crash_semantics(CrashSemantics::DirtySubsetAndSectorTear);
|
||||
let path = format!("{bucket}/{key}/{STORAGE_FORMAT_FILE}");
|
||||
let original = sim.sim().read_file(&path).await.unwrap();
|
||||
let mut next = disk.read_version("", bucket, key, "", &ReadOptions::default()).await.unwrap();
|
||||
next.metadata.insert("x-amz-meta-probe".into(), "updated".into());
|
||||
let point = CrashPoint::MetaWriteAfterTmpBeforeRename;
|
||||
fixture.crash_registry.arm_on_drive(point, key, "dst-node0", 0);
|
||||
assert!(disk.write_metadata("", bucket, key, next.clone()).await.is_err());
|
||||
assert!(!fixture.crash_registry.take_if_armed_on_drive(point, key, "dst-node0", 0));
|
||||
fixture.crash_and_reboot_all();
|
||||
assert_eq!(sim.sim().read_file(&path).await.unwrap(), original);
|
||||
assert_eq!(get_bytes(&fixture, bucket, key).await.unwrap(), b"committed");
|
||||
disk.write_metadata("", bucket, key, next).await.unwrap();
|
||||
fixture.crash_and_reboot_all();
|
||||
let updated = disk.read_version("", bucket, key, "", &ReadOptions::default()).await.unwrap();
|
||||
assert_eq!(updated.metadata.get("x-amz-meta-probe").map(String::as_str), Some("updated"));
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
@@ -940,10 +902,6 @@ async fn dst_prod_test5_multipart_commit_crash_cutpoints_before_rename_and_befor
|
||||
// ------------------------------------------------------------------------
|
||||
let mut before_cleanup_hits = 0usize;
|
||||
for &seed in &[0x4D50_0101_u64, 0x4D50_0102_u64, 0x4D50_0103_u64, 0x4D50_0104_u64] {
|
||||
let opts = ObjectOptions {
|
||||
versioned: seed % 2 == 0,
|
||||
..dst_object_options()
|
||||
};
|
||||
let fixture = make_dst_sim_set_disks(seed, 4, 2, None)
|
||||
.await
|
||||
.expect("dst sim SetDisks for multipart pre-cleanup cutpoint");
|
||||
@@ -1001,7 +959,7 @@ async fn dst_prod_test5_multipart_commit_crash_cutpoints_before_rename_and_befor
|
||||
let crashed = fixture
|
||||
.set_disks
|
||||
.clone()
|
||||
.complete_multipart_upload(bucket, &key, &upload.upload_id, parts.clone(), &opts)
|
||||
.complete_multipart_upload(bucket, &key, &upload.upload_id, parts, &opts)
|
||||
.await;
|
||||
assert!(
|
||||
crashed.is_err(),
|
||||
@@ -1027,21 +985,6 @@ async fn dst_prod_test5_multipart_commit_crash_cutpoints_before_rename_and_befor
|
||||
"seed={seed:#x}: committed multipart payload must be bit-exact after pre-cleanup crash"
|
||||
);
|
||||
|
||||
// A client that lost the completion response must recover the identity of
|
||||
// the existing commit, including the version ID on a versioned bucket.
|
||||
let published = fixture.set_disks.get_object_info(bucket, &key, &opts).await.unwrap();
|
||||
assert_eq!(published.version_id.is_some(), opts.versioned);
|
||||
let retried = fixture
|
||||
.set_disks
|
||||
.clone()
|
||||
.complete_multipart_upload(bucket, &key, &upload.upload_id, parts, &opts)
|
||||
.await
|
||||
.expect("complete retry after post-commit power loss");
|
||||
assert!(retried.multipart_completion_replayed, "seed={seed:#x}: upload committed again");
|
||||
assert_eq!(retried.version_id, published.version_id);
|
||||
assert_eq!(retried.etag, published.etag);
|
||||
assert_eq!(get_bytes(&fixture, bucket, &key).await.unwrap(), expected);
|
||||
|
||||
// Post-crash heal converges cleanly and every drive verifies both parts!
|
||||
let (_heal_item, heal_err) = fixture
|
||||
.set_disks
|
||||
@@ -1073,13 +1016,6 @@ async fn dst_prod_test5_multipart_commit_crash_cutpoints_before_rename_and_befor
|
||||
vec![CHECK_PART_SUCCESS, CHECK_PART_SUCCESS],
|
||||
"drive {slot} must pass HighwayHash256S verification for both parts"
|
||||
);
|
||||
let raw = disk.read_all(bucket, &format!("{key}/{STORAGE_FORMAT_FILE}")).await.unwrap();
|
||||
let versions = FileMeta::load(&raw)
|
||||
.unwrap()
|
||||
.get_all_file_info_versions(bucket, &key, true)
|
||||
.unwrap();
|
||||
assert_eq!(versions.versions.len(), 1, "drive {slot}: duplicate multipart commit");
|
||||
assert_eq!(versions.versions[0].version_id, published.version_id);
|
||||
}
|
||||
}
|
||||
assert_eq!(
|
||||
@@ -1087,77 +1023,3 @@ async fn dst_prod_test5_multipart_commit_crash_cutpoints_before_rename_and_befor
|
||||
"fault.multipart_crashed_before_cleanup must hit across all 4 seeds"
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn multipart_replay_rejects_missing_or_other_disk_anchor() {
|
||||
let fixture = make_dst_sim_set_disks(0x671, 4, 2, None).await.unwrap();
|
||||
let bucket = "dst-mpu-anchor";
|
||||
let key = "published";
|
||||
let opts = dst_object_options();
|
||||
fixture
|
||||
.set_disks
|
||||
.make_bucket(bucket, &MakeBucketOptions::default())
|
||||
.await
|
||||
.unwrap();
|
||||
let upload = fixture.set_disks.new_multipart_upload(bucket, key, &opts).await.unwrap();
|
||||
let expected = deterministic_payload(0x671, key, 128 * 1024);
|
||||
let mut payload = PutObjReader::from_vec(expected.clone());
|
||||
let part = fixture
|
||||
.set_disks
|
||||
.put_object_part(bucket, key, &upload.upload_id, 1, &mut payload, &opts)
|
||||
.await
|
||||
.unwrap();
|
||||
let parts = vec![CompletePart {
|
||||
part_num: 1,
|
||||
etag: part.etag,
|
||||
..Default::default()
|
||||
}];
|
||||
let complete = || {
|
||||
fixture
|
||||
.set_disks
|
||||
.clone()
|
||||
.complete_multipart_upload(bucket, key, &upload.upload_id, parts.clone(), &opts)
|
||||
};
|
||||
let published = complete().await.unwrap();
|
||||
fixture.crash_and_reboot_all();
|
||||
let replayed = complete().await.expect("all four witnesses are available");
|
||||
assert!(replayed.multipart_completion_replayed);
|
||||
assert_eq!(replayed.etag, published.etag);
|
||||
|
||||
let info = fixture.disks[0]
|
||||
.read_version("", bucket, key, "", &ReadOptions::default())
|
||||
.await
|
||||
.unwrap();
|
||||
let anchor =
|
||||
rustfs_ecstore::api::dst::DstSimDisk::multipart_retirement_anchor_path(bucket, key, info.data_dir.unwrap()).unwrap();
|
||||
let (parent, _) = anchor.rsplit_once('/').unwrap();
|
||||
let disks = &fixture.sim_disks;
|
||||
let own_0 = disks[0].sim().read_file(&anchor).await.unwrap();
|
||||
let own_1 = disks[1].sim().read_file(&anchor).await.unwrap();
|
||||
let foreign = disks[2].sim().read_file(&anchor).await.unwrap();
|
||||
for disk in &disks[..2] {
|
||||
disk.sim().remove_file(&anchor).await.unwrap();
|
||||
disk.sim().fsync_dir(parent).await.unwrap();
|
||||
}
|
||||
fixture.crash_and_reboot_all();
|
||||
assert_eq!(get_bytes(&fixture, bucket, key).await.unwrap(), expected);
|
||||
assert!(matches!(complete().await, Err(EcstoreError::ErasureWriteQuorum)));
|
||||
|
||||
disks[0].sim().write_file(&anchor, foreign).await.unwrap();
|
||||
disks[0].sim().fsync_file(&anchor).await.unwrap();
|
||||
disks[0].sim().fsync_dir(parent).await.unwrap();
|
||||
fixture.crash_and_reboot_all();
|
||||
assert!(matches!(complete().await, Err(EcstoreError::ErasureWriteQuorum)));
|
||||
|
||||
for (disk, own) in disks[..2].iter().zip([own_0, own_1]) {
|
||||
disk.sim().write_file(&anchor, own).await.unwrap();
|
||||
disk.sim().fsync_file(&anchor).await.unwrap();
|
||||
disk.sim().fsync_dir(parent).await.unwrap();
|
||||
}
|
||||
fixture.crash_and_reboot_all();
|
||||
let replayed = complete()
|
||||
.await
|
||||
.expect("each restored witness belongs to its own physical disk");
|
||||
assert!(replayed.multipart_completion_replayed);
|
||||
assert_eq!(replayed.etag, published.etag);
|
||||
}
|
||||
|
||||
@@ -1428,9 +1428,6 @@ impl VaultTransitKmsClient {
|
||||
}
|
||||
})
|
||||
.await?;
|
||||
// Transit LIST also returns directory entries, including the BYOK
|
||||
// wrapping-key directory. Only actual key names belong in the cursor.
|
||||
all_keys.retain(|key| !key.ends_with('/'));
|
||||
// Vault's own LIST ordering is not part of its contract, so the sort is
|
||||
// what makes the marker a stable cursor across calls.
|
||||
all_keys.sort_unstable();
|
||||
@@ -2071,70 +2068,6 @@ mod tests {
|
||||
serde_json::to_value(&response).expect("serialize transit key read response")
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn list_skips_byok_directories_before_pagination() {
|
||||
let listed = serde_json::json!({ "keys": ["zulu", "import/", "import", "alpha", "versions/"] });
|
||||
let metadata = metadata_read_data(&TransitKeyMetadata::from_create_request(&CreateKeyRequest::default()));
|
||||
let (vault, client) = scripted_client(vec![
|
||||
ScriptedResponse::ok(listed.clone()),
|
||||
ScriptedResponse::ok(transit_key_read_data("alpha")),
|
||||
ScriptedResponse::ok(metadata.clone()),
|
||||
ScriptedResponse::ok(transit_key_read_data("import")),
|
||||
ScriptedResponse::ok(metadata.clone()),
|
||||
ScriptedResponse::ok(listed),
|
||||
ScriptedResponse::ok(transit_key_read_data("zulu")),
|
||||
ScriptedResponse::ok(metadata),
|
||||
])
|
||||
.await;
|
||||
|
||||
let first = client
|
||||
.list_keys(
|
||||
&ListKeysRequest {
|
||||
limit: Some(2),
|
||||
..Default::default()
|
||||
},
|
||||
None,
|
||||
)
|
||||
.await
|
||||
.expect("list the first page despite directory entries");
|
||||
assert_eq!(first.keys.iter().map(|key| key.key_id.as_str()).collect::<Vec<_>>(), ["alpha", "import"]);
|
||||
assert_eq!(first.next_marker.as_deref(), Some("import"));
|
||||
assert!(first.truncated);
|
||||
assert!(first.unreadable_key_ids.is_empty());
|
||||
|
||||
let last = client
|
||||
.list_keys(
|
||||
&ListKeysRequest {
|
||||
limit: Some(2),
|
||||
marker: first.next_marker,
|
||||
..Default::default()
|
||||
},
|
||||
None,
|
||||
)
|
||||
.await
|
||||
.expect("a sweep can continue past the wrapping-key directory");
|
||||
assert_eq!(last.keys.iter().map(|key| key.key_id.as_str()).collect::<Vec<_>>(), ["zulu"]);
|
||||
assert!(last.next_marker.is_none());
|
||||
assert!(!last.truncated);
|
||||
assert!(last.unreadable_key_ids.is_empty());
|
||||
assert_eq!(vault.requests().len(), 8, "only actual keys should be described");
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn list_with_only_the_byok_directory_is_empty() {
|
||||
let (vault, client) = scripted_client(vec![ScriptedResponse::ok(serde_json::json!({ "keys": ["import/"] }))]).await;
|
||||
|
||||
let listed = client
|
||||
.list_keys(&ListKeysRequest::default(), None)
|
||||
.await
|
||||
.expect("the wrapping-key directory is not a KMS key");
|
||||
assert!(listed.keys.is_empty());
|
||||
assert!(listed.next_marker.is_none());
|
||||
assert!(!listed.truncated);
|
||||
assert!(listed.unreadable_key_ids.is_empty());
|
||||
assert_eq!(vault.requests().len(), 1, "a directory must not be described");
|
||||
}
|
||||
|
||||
/// A listing must not silently shrink when the backend is the problem.
|
||||
///
|
||||
/// Before the per-key classification this path used `?`, so any describe
|
||||
@@ -2143,7 +2076,7 @@ mod tests {
|
||||
/// about it. A transit mount that stops answering must still fail loudly.
|
||||
#[tokio::test]
|
||||
async fn list_fails_when_a_transit_key_read_is_unavailable() {
|
||||
let mut responses = vec![ScriptedResponse::ok(serde_json::json!({ "keys": ["import/", "key-a"] }))];
|
||||
let mut responses = vec![ScriptedResponse::ok(serde_json::json!({ "keys": ["key-a"] }))];
|
||||
for _ in 0..3 {
|
||||
responses.push(ScriptedResponse::error(503, "temporarily unavailable"));
|
||||
}
|
||||
|
||||
@@ -22,8 +22,6 @@ Specialized boundary, hardware and alternate-feature lanes run only on the sched
|
||||
|
||||
Workspace Clippy runs on every event with a selected workspace Rust job, pull requests included, in its own `Workspace Clippy` job. It runs beside `Workspace Lint and Build` instead of in front of it, because check-mode metadata and the linked test binaries share no compiler output; `scripts/ci_gate.py --check-workflow` rejects a workflow in which the archive producer or any archive consumer waits for the lint, or in which the lint leaves the aggregate. `Workspace Lint and Build` keeps its name as the archive producer: it creates the exact test archive and runs doctests; `Workspace tests` consumes the archive without rebuilding it. `cache-warm.yml` warms Clippy's check artifacts under `ci-dev` with the same invocation to reuse compatible dependency artifacts. `make pre-commit` does not run Clippy. Select local Clippy targets, features, and documentation exemptions from the root `AGENTS.md` verification tier; the workspace command below reproduces the CI lane and is not a universal pre-push requirement.
|
||||
|
||||
Full-scope runs also execute the production ECStore suite in `dst_production_ecstore` against simulated disks with `--features dst`. It checks the durability of acknowledged writes, metadata publication, and multipart retries with valid, missing, or misplaced per-drive evidence. The workspace producer retains the nextest listing and JUnit report and verifies that every required case passed.
|
||||
|
||||
Serial ILM tests run at the end of `workspace-tests` for the `full` scope, consuming the same verified archive as ordinary workspace tests. The existing ignored-test filter and `-j1` remain; `--profile default` keeps the no-retry execution and preserves the separate core CI JUnit report. Any ILM failure fails the consumer and required aggregate. Logs remain in the workspace test evidence artifact. There is no separate ILM compilation or cache restore.
|
||||
|
||||
`required-checks` runs even after failed or skipped dependencies. `scripts/ci_gate.py verify` rejects missing jobs, unexpected jobs, failure, cancellation, and unexpected skips; optional lanes are required only on their declared events. `Workspace Clippy` is the workspace lint, `Workspace Lint and Build` and `Workspace tests` are the ordinary Rust producer and consumer, while `Test and Lint` uniquely names the aggregate. New validation jobs must update both its direct dependencies and the script contract. A report-only lane is registered in `REPORT_ONLY_JOBS` instead: it stays out of the aggregate, must keep its distinguishing environment, and must keep the steps it reruns identical to the required job it mirrors. Test this wiring and its failure cases with `python3 scripts/ci_gate.py --self-test`.
|
||||
@@ -67,6 +65,7 @@ The four site-replication state-writer concurrency proofs reserve the available
|
||||
| PR touching `paths` in `audit.yml` | `Cargo Deny`, `Workflow Pin Report`, `Dependency Review` | `audit.yml` `cargo-deny`, `workflow-pin-report`, `dependency-review` | Report-only | `cargo deny check`; `scripts/security/check_workflow_pins.sh` |
|
||||
| PR touching `paths` in `nix.yml` | `Nix Build & Check` | `nix.yml` `nix-validation` | Report-only | `nix flake check` |
|
||||
| PR touching `paths` in `windows-filesystem.yml` | `Rename Safety`, `Startup Smoke` | `windows-filesystem.yml` `rename-safety`, `startup-smoke` | Report-only | the `cargo test -p rustfs-ecstore --lib <filter>` commands in the job, on Windows; `cargo build --locked -p rustfs --bin rustfs`, then `rustfs.exe --version` and a single-volume server polled on `/health/ready` |
|
||||
| PR or main push touching `paths` in `rdma-build.yml` | `cargo check and test compile (nixl)` | `rdma-build.yml` `nixl-build` | Report-only | `cargo check --locked -p rustfs --features nixl`; `cargo test --locked --no-run -p rustfs-nixl --features client-http` |
|
||||
| PR touching `paths` in `coverage.yml` | `Workspace line coverage` | `coverage.yml` `coverage` | Report-only | `make coverage`; `python3 scripts/check_security_coverage.py target/llvm-cov/coverage.json` |
|
||||
| PR touching `paths` in `oidc-keycloak.yml` | `OIDC Keycloak live gate` | `oidc-keycloak.yml` `oidc-keycloak-live` | Report-only | `cargo build --locked -p rustfs --bin rustfs`, then `bash scripts/test/oidc_keycloak_live.sh ./target/debug/rustfs` |
|
||||
| PR touching `paths` in `targets-integration.yml` | `PostgreSQL, MySQL, AMQP, and NATS` | `targets-integration.yml` `targets-live` | Report-only | start the containers as in the job, export the `RUSTFS_TEST_*` DSNs, then the job's `cargo test --locked -p rustfs-targets --test <name> -- --ignored --test-threads=1` commands |
|
||||
|
||||
@@ -50,6 +50,70 @@ debug = "line-tables-only"
|
||||
[profile.dev.package."*"]
|
||||
debug = false
|
||||
|
||||
# `cargo-fuzz build` compiles in release mode with `--config profile.release.debug="line-tables-only"`.
|
||||
# Keep third-party dependencies (DataFusion, Arrow, Parquet, AWS SDK) at opt-level 1 without DWARF
|
||||
# debuginfo so instrumented builds stay within the runner memory and artifact budgets, while
|
||||
# preserving full optimization and line tables for the fuzz crate and RustFS workspace crates.
|
||||
[profile.release]
|
||||
opt-level = 3
|
||||
debug = "line-tables-only"
|
||||
|
||||
[profile.release.package."*"]
|
||||
opt-level = 1
|
||||
debug = false
|
||||
|
||||
[profile.release.package.rustfs-ecstore]
|
||||
opt-level = 3
|
||||
debug = "line-tables-only"
|
||||
|
||||
[profile.release.package.rustfs-filemeta]
|
||||
opt-level = 3
|
||||
debug = "line-tables-only"
|
||||
|
||||
[profile.release.package.rustfs-kms]
|
||||
opt-level = 3
|
||||
debug = "line-tables-only"
|
||||
|
||||
[profile.release.package.rustfs-lifecycle]
|
||||
opt-level = 3
|
||||
debug = "line-tables-only"
|
||||
|
||||
[profile.release.package.rustfs-notify]
|
||||
opt-level = 3
|
||||
debug = "line-tables-only"
|
||||
|
||||
[profile.release.package.rustfs-policy]
|
||||
opt-level = 3
|
||||
debug = "line-tables-only"
|
||||
|
||||
[profile.release.package.rustfs-rio]
|
||||
opt-level = 3
|
||||
debug = "line-tables-only"
|
||||
|
||||
[profile.release.package.rustfs-s3select-api]
|
||||
opt-level = 3
|
||||
debug = "line-tables-only"
|
||||
|
||||
[profile.release.package.rustfs-s3select-query]
|
||||
opt-level = 3
|
||||
debug = "line-tables-only"
|
||||
|
||||
[profile.release.package.rustfs-security-governance]
|
||||
opt-level = 3
|
||||
debug = "line-tables-only"
|
||||
|
||||
[profile.release.package.rustfs-signer]
|
||||
opt-level = 3
|
||||
debug = "line-tables-only"
|
||||
|
||||
[profile.release.package.rustfs-sse]
|
||||
opt-level = 3
|
||||
debug = "line-tables-only"
|
||||
|
||||
[profile.release.package.rustfs-utils]
|
||||
opt-level = 3
|
||||
debug = "line-tables-only"
|
||||
|
||||
[[bin]]
|
||||
name = "bucket_validation"
|
||||
path = "fuzz_targets/bucket_validation.rs"
|
||||
|
||||
@@ -2383,6 +2383,7 @@ mod tests {
|
||||
#[serial_test::serial]
|
||||
async fn http3_certificate_reload_updates_handshakes_and_retains_valid_config() {
|
||||
use crate::server::http3::tests::{client_endpoint, connect};
|
||||
ensure_rustls_crypto_provider();
|
||||
let dir = TempDir::new().expect("TLS directory");
|
||||
write_test_cert_pair(dir.path(), "localhost");
|
||||
let snapshot = load_tls_material(dir.path().to_str().expect("TLS path"))
|
||||
|
||||
@@ -24,16 +24,6 @@ CORE_TESTS = {
|
||||
"head_object_consistency_test::head_object_consistency_after_write_and_multipart_and_presigned_head",
|
||||
"storage_class_capability_test::tests::historical_label_only_metadata_is_standard_without_hiding_a_real_transition_tier",
|
||||
}
|
||||
DST_SUITE = "rustfs-ecstore::dst_production_ecstore"
|
||||
DST_TESTS = {
|
||||
"dst_prod_test1_quorum_put_get_delete_offline_and_enospc",
|
||||
"dst_prod_test2_physical_bitrot_highwayhash_detect_reconstruct_and_heal",
|
||||
"dst_prod_test3_alice_power_loss_crash_consistency_old_or_new_never_mixed",
|
||||
"metadata_write_crash_preserves_published_metadata",
|
||||
"dst_prod_test4_deterministic_multiseed_concurrent_chaos_and_replay_equivalence",
|
||||
"dst_prod_test5_multipart_commit_crash_cutpoints_before_rename_and_before_cleanup",
|
||||
"multipart_replay_rejects_missing_or_other_disk_anchor",
|
||||
}
|
||||
|
||||
|
||||
def output(*args):
|
||||
@@ -161,16 +151,12 @@ def selected_tests(listing):
|
||||
return selected
|
||||
|
||||
|
||||
def verify_execution(listing, junit, core=False, dst=False):
|
||||
def verify_execution(listing, junit, core=False):
|
||||
inventory = json.loads(Path(listing).read_text())
|
||||
expected = selected_tests(inventory)
|
||||
known = {(binary, name) for binary, suite in inventory["rust-suites"].items() for name in suite["testcases"]}
|
||||
if core and (len(expected) != len(CORE_TESTS) or {name for _, name in expected} != CORE_TESTS):
|
||||
raise ValueError("core contract must select exactly the write/read, denial and restart proofs")
|
||||
if dst:
|
||||
missing = {(DST_SUITE, name) for name in DST_TESTS} - expected
|
||||
if missing:
|
||||
raise ValueError(f"missing production DST tests: {sorted(missing)}")
|
||||
report = ET.parse(junit).getroot()
|
||||
if report.tag != "testsuites" or report.get("failures") != "0" or report.get("errors") != "0":
|
||||
raise ValueError("test report must be a successful nextest run")
|
||||
@@ -215,9 +201,7 @@ def main():
|
||||
child = sub.add_parser("evidence")
|
||||
child.add_argument("listing", type=Path)
|
||||
child.add_argument("junit", type=Path)
|
||||
required = child.add_mutually_exclusive_group()
|
||||
required.add_argument("--core", action="store_true")
|
||||
required.add_argument("--dst", action="store_true")
|
||||
child.add_argument("--core", action="store_true")
|
||||
args = parser.parse_args()
|
||||
try:
|
||||
if args.command == "build":
|
||||
@@ -237,7 +221,7 @@ def main():
|
||||
"doc": [*selection, "--doc"], "warm": ["--no-run", *selection]}[args.operation]
|
||||
subprocess.run(command, cwd=ROOT, check=True)
|
||||
else:
|
||||
print(f"Verified {verify_execution(args.listing, args.junit, args.core, args.dst)} test executions")
|
||||
print(f"Verified {verify_execution(args.listing, args.junit, args.core)} test executions")
|
||||
except (OSError, ValueError, KeyError, TypeError, ET.ParseError, subprocess.CalledProcessError) as error:
|
||||
print(f"verification artifact: {error}", file=sys.stderr)
|
||||
return 1
|
||||
|
||||
+21
-4
@@ -31,6 +31,7 @@
|
||||
# SKIP_BUILD — set to 1 to skip build phase (default: 0)
|
||||
# USE_PREBUILT_BINARY — set to 1 to run a prebuilt fuzz binary directly
|
||||
# PREBUILT_BINARY_DIR — directory containing prebuilt fuzz binaries
|
||||
# FUZZ_CODEGEN_UNITS — optional positive integer passed as --codegen-units to cargo-fuzz
|
||||
|
||||
set -eu
|
||||
|
||||
@@ -45,6 +46,7 @@ BUILD_ONLY=${BUILD_ONLY:-0}
|
||||
SKIP_BUILD=${SKIP_BUILD:-0}
|
||||
USE_PREBUILT_BINARY=${USE_PREBUILT_BINARY:-0}
|
||||
PREBUILT_BINARY_DIR=${PREBUILT_BINARY_DIR:-}
|
||||
FUZZ_CODEGEN_UNITS=${FUZZ_CODEGEN_UNITS:-}
|
||||
|
||||
case "$MAX_TOTAL_TIME" in
|
||||
''|0*|*[!0-9]*)
|
||||
@@ -62,6 +64,15 @@ if [ -n "$FUZZ_SEED" ]; then
|
||||
esac
|
||||
fi
|
||||
|
||||
if [ -n "$FUZZ_CODEGEN_UNITS" ]; then
|
||||
case "$FUZZ_CODEGEN_UNITS" in
|
||||
0*|*[!0-9]*)
|
||||
echo "FUZZ_CODEGEN_UNITS must be a positive decimal integer without leading zeroes: $FUZZ_CODEGEN_UNITS" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
cd "$FUZZ_DIR"
|
||||
mkdir -p "$ARTIFACT_ROOT"
|
||||
|
||||
@@ -126,7 +137,10 @@ PY
|
||||
if [ "$SKIP_BUILD" != "1" ]; then
|
||||
set --
|
||||
if [ -n "${CARGO_TARGET_DIR:-}" ]; then
|
||||
set -- --target-dir "$CARGO_TARGET_DIR"
|
||||
set -- "$@" --target-dir "$CARGO_TARGET_DIR"
|
||||
fi
|
||||
if [ -n "$FUZZ_CODEGEN_UNITS" ]; then
|
||||
set -- "$@" --codegen-units "$FUZZ_CODEGEN_UNITS"
|
||||
fi
|
||||
if [ "$targets" = "$registered_targets" ]; then
|
||||
# A single Cargo invocation shares the instrumented dependency build across all harnesses.
|
||||
@@ -208,11 +222,14 @@ for target in $targets; do
|
||||
else
|
||||
echo "==> cargo +nightly fuzz run $target (-max_total_time=$MAX_TOTAL_TIME, -seed=$seed, -artifact_prefix=$artifact_dir/)"
|
||||
set +e
|
||||
set --
|
||||
if [ -n "${CARGO_TARGET_DIR:-}" ]; then
|
||||
cargo +nightly fuzz run --target-dir "$CARGO_TARGET_DIR" "$target" -- -max_total_time="$MAX_TOTAL_TIME" -seed="$seed" -artifact_prefix="$artifact_dir/"
|
||||
else
|
||||
cargo +nightly fuzz run "$target" -- -max_total_time="$MAX_TOTAL_TIME" -seed="$seed" -artifact_prefix="$artifact_dir/"
|
||||
set -- "$@" --target-dir "$CARGO_TARGET_DIR"
|
||||
fi
|
||||
if [ -n "$FUZZ_CODEGEN_UNITS" ]; then
|
||||
set -- "$@" --codegen-units "$FUZZ_CODEGEN_UNITS"
|
||||
fi
|
||||
cargo +nightly fuzz run "$@" "$target" -- -max_total_time="$MAX_TOTAL_TIME" -seed="$seed" -artifact_prefix="$artifact_dir/"
|
||||
exit_code=$?
|
||||
set -e
|
||||
fi
|
||||
|
||||
@@ -244,10 +244,10 @@ class ExecutionEvidenceTests(unittest.TestCase):
|
||||
self.listing = listing([("crate-a", "one", False), ("crate-b", "two", False), ("crate-b", "ignored", True)])
|
||||
self.report = junit([("crate-a", "one", None), ("crate-b", "two", None)])
|
||||
|
||||
def verify(self, listing_value=None, report=None, *, core=False, dst=False):
|
||||
def verify(self, listing_value=None, report=None, *, core=False):
|
||||
self.listing_file.write_text(json.dumps(self.listing if listing_value is None else listing_value))
|
||||
ET.ElementTree(self.report if report is None else report).write(self.junit_file)
|
||||
return artifact.verify_execution(self.listing_file, self.junit_file, core=core, dst=dst)
|
||||
return artifact.verify_execution(self.listing_file, self.junit_file, core=core)
|
||||
|
||||
def test_exact_selected_set_and_known_ignored_cases(self):
|
||||
self.assertEqual(self.verify(), 2)
|
||||
@@ -321,17 +321,6 @@ class ExecutionEvidenceTests(unittest.TestCase):
|
||||
with self.subTest(attribute=attribute), self.assertRaises(ValueError):
|
||||
self.verify(report=report)
|
||||
|
||||
def test_dst_rejects_a_green_report_with_a_missing_required_test(self):
|
||||
cases = [(artifact.DST_SUITE, name) for name in sorted(artifact.DST_TESTS)]
|
||||
for selected in [cases, cases[:-1]]:
|
||||
inventory = listing([(suite, name, False) for suite, name in selected])
|
||||
report = junit([(suite, name, None) for suite, name in selected])
|
||||
if selected == cases:
|
||||
self.assertEqual(self.verify(inventory, report, dst=True), len(cases))
|
||||
else:
|
||||
with self.assertRaisesRegex(ValueError, "missing production DST tests"):
|
||||
self.verify(inventory, report, dst=True)
|
||||
|
||||
def test_core_requires_exactly_three_selected_proofs(self):
|
||||
names = sorted(artifact.CORE_TESTS)
|
||||
core_listing = listing([("e2e", name, False) for name in names])
|
||||
|
||||
@@ -140,4 +140,25 @@ for invalid_target in nonexistent "path_containment;id"; do
|
||||
fi
|
||||
done
|
||||
|
||||
PATH="$TMP_ROOT/bin:$PATH" \
|
||||
FAKE_CARGO_ARGS_FILE="$TMP_ROOT/build-cgu-args" \
|
||||
FUZZ_TARGET=path_containment \
|
||||
FUZZ_CODEGEN_UNITS=16 \
|
||||
BUILD_ONLY=1 \
|
||||
"$REPO_ROOT/scripts/fuzz/run.sh"
|
||||
|
||||
grep -Fx '+nightly' "$TMP_ROOT/build-cgu-args"
|
||||
grep -Fx 'fuzz' "$TMP_ROOT/build-cgu-args"
|
||||
grep -Fx 'build' "$TMP_ROOT/build-cgu-args"
|
||||
grep -Fx -- '--codegen-units' "$TMP_ROOT/build-cgu-args"
|
||||
grep -Fx '16' "$TMP_ROOT/build-cgu-args"
|
||||
grep -Fx 'path_containment' "$TMP_ROOT/build-cgu-args"
|
||||
|
||||
for invalid_cgu in 0 016 not-a-number "16;id"; do
|
||||
if FUZZ_TARGET=path_containment FUZZ_CODEGEN_UNITS="$invalid_cgu" BUILD_ONLY=1 "$REPO_ROOT/scripts/fuzz/run.sh" >/dev/null 2>&1; then
|
||||
echo "invalid FUZZ_CODEGEN_UNITS was accepted: $invalid_cgu" >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
echo "fuzz runner seed manifest tests passed"
|
||||
|
||||
Reference in New Issue
Block a user