From b4192576ebf8ced4ba654975602dcf1f308a8bea Mon Sep 17 00:00:00 2001 From: pingqiu Date: Mon, 6 Jul 2026 15:34:05 -0700 Subject: [PATCH] phase145: reduce wal batch record allocation --- seaweed-block/core/storage/wal_writer.go | 9 +- seaweed-block/core/storage/walstore.go | 4 +- .../docs/releases/nvme-tcp-supported-lab.md | 20 ++ seaweed-block/docs/roadmap.md | 3 +- seaweed-block/internal/docs/current-plan.md | 75 +++----- ...an_wal_record_materialization_reduction.md | 57 ++++++ .../internal/docs/product-roadmap.md | 5 + ...rd-materialization-reduction-qa-signoff.md | 68 +++++++ ...l-record-materialization-reduction-gate.sh | 147 +++++++++++++++ ...ecord-materialization-reduction-chain.yaml | 175 ++++++++++++++++++ 10 files changed, 511 insertions(+), 52 deletions(-) create mode 100644 seaweed-block/internal/docs/finished-plans/phase145_finishedplan_wal_record_materialization_reduction.md create mode 100644 seaweed-block/internal/docs/qa-assignments/phase145-wal-record-materialization-reduction-qa-signoff.md create mode 100644 seaweed-block/scripts/run-phase145-wal-record-materialization-reduction-gate.sh create mode 100644 seaweed-block/testops/scenarios/nvme-tcp-wal-record-materialization-reduction-chain.yaml diff --git a/seaweed-block/core/storage/wal_writer.go b/seaweed-block/core/storage/wal_writer.go index 6de6b5de08..adc707f70f 100644 --- a/seaweed-block/core/storage/wal_writer.go +++ b/seaweed-block/core/storage/wal_writer.go @@ -107,13 +107,13 @@ func (w *walWriter) append(entry *walEntry) (walRelOffset uint64, err error) { // appendBatch writes entries under one WAL-writer critical section. Each entry // remains independently encoded/recoverable; the batch only coalesces adjacent // bytes into fewer pwrite calls when the circular WAL layout allows it. -func (w *walWriter) appendBatch(entries []*walEntry) ([]uint64, error) { +func (w *walWriter) appendBatch(entries []walEntry) ([]uint64, error) { if len(entries) == 0 { return nil, nil } lengths := make([]uint64, len(entries)) - for i, entry := range entries { - entryLen, err := entry.encodedSize() + for i := range entries { + entryLen, err := entries[i].encodedSize() if err != nil { return nil, fmt.Errorf("walWriter.appendBatch: validate entry %d: %w", i, err) } @@ -186,7 +186,8 @@ func (w *walWriter) appendBatch(entries []*walEntry) ([]uint64, error) { return nil } - for i, entry := range entries { + for i := range entries { + entry := &entries[i] entryLen := lengths[i] physHead := w.physicalPos(localHead) remaining := w.walSize - physHead diff --git a/seaweed-block/core/storage/walstore.go b/seaweed-block/core/storage/walstore.go index 68756074ed..f8215ca2c9 100644 --- a/seaweed-block/core/storage/walstore.go +++ b/seaweed-block/core/storage/walstore.go @@ -449,12 +449,12 @@ func (s *WALStore) WriteBatch(startLBA uint32, blocks [][]byte) ([]uint64, error s.nextLSN += uint64(len(blocks)) s.mu.Unlock() - entries := make([]*walEntry, len(blocks)) + entries := make([]walEntry, len(blocks)) lsns := make([]uint64, len(blocks)) for i, data := range blocks { lsn := firstLSN + uint64(i) lsns[i] = lsn - entries[i] = &walEntry{ + entries[i] = walEntry{ LSN: lsn, Type: walEntryWrite, LBA: uint64(startLBA + uint32(i)), diff --git a/seaweed-block/docs/releases/nvme-tcp-supported-lab.md b/seaweed-block/docs/releases/nvme-tcp-supported-lab.md index 3665b300c2..b102d268bc 100644 --- a/seaweed-block/docs/releases/nvme-tcp-supported-lab.md +++ b/seaweed-block/docs/releases/nvme-tcp-supported-lab.md @@ -86,6 +86,7 @@ The supported-lab claim is intentionally narrow: | 142 | 64KiB NVMe/TCP post-H2C backend bottleneck retriage | PASS | | 143 | 64KiB NVMe/TCP WAL append shape profile | PASS | | 144 | 64KiB NVMe/TCP WAL encode/append pair profile | PASS | +| 145 | WAL record materialization allocation reduction | PASS | Key QA sign-offs: @@ -114,6 +115,7 @@ Key QA sign-offs: - `internal/docs/qa-assignments/phase142-nvme-tcp-large-h2c-retriage-qa-signoff.md` - `internal/docs/qa-assignments/phase143-wal-append-large-h2c-profile-qa-signoff.md` - `internal/docs/qa-assignments/phase144-wal-encode-append-pair-profile-qa-signoff.md` +- `internal/docs/qa-assignments/phase145-wal-record-materialization-reduction-qa-signoff.md` ## Performance Baseline @@ -473,6 +475,24 @@ cleanup_status=ok The next backend work is a narrow WAL record materialization reduction, still behind source-gated lab evidence. +Phase 145 made the first narrow materialization reduction: + +```text +phase145_wal_record_materialization_reduction_status=ok +wal_record_materialization_change=writebatch_value_entries +unit_record_compatibility=pass +candidate_max_h2c_bytes=65536 +target_write_request_max_bytes=65536 +backend_write_request_max_bytes=65536 +writer_verified=true +reader_verified=true +phase145_decision=keep_change +cleanup_status=ok +``` + +The change removes per-record pointer allocation in `WALStore.WriteBatch`. +It preserves WAL format/recovery semantics and is not yet a performance claim. + Phase 127 closes the source/component side of the ANA Change Notice gap: ```text diff --git a/seaweed-block/docs/roadmap.md b/seaweed-block/docs/roadmap.md index 1f06e1442b..007c7fd4b5 100644 --- a/seaweed-block/docs/roadmap.md +++ b/seaweed-block/docs/roadmap.md @@ -110,7 +110,8 @@ Seaweed Block can already demonstrate a narrow Kubernetes block-storage loop: bottleneck is WAL append, not frontend request size. The append bucket is paired with near-equal WAL encode cost; Phase 144 names `wal_record_materialization_reduction` as the next narrow backend target. - This is still not a default or performance/SLO claim. + Phase 145 removes one local batch-allocation seam without changing WAL format + or recovery semantics. This is still not a default or performance/SLO claim. - Kubernetes NVMe/TCP mounted reconnect is source-gated through changed desired path-set evidence: CSI-node can connect a newly published desired NVMe path, prune the stale old host path for the same NQN, preserve pod diff --git a/seaweed-block/internal/docs/current-plan.md b/seaweed-block/internal/docs/current-plan.md index 153e00eded..31a8eae6d6 100644 --- a/seaweed-block/internal/docs/current-plan.md +++ b/seaweed-block/internal/docs/current-plan.md @@ -1,84 +1,69 @@ -# Current Plan: Phase 145 WAL Record Materialization Reduction +# Current Plan: Phase 146 WAL Record Materialization Effectiveness Profile Status: planning. -Phase 144 closed the encode/append pair profile: +Phase 145 closed a narrow WAL record materialization reduction: ```text -phase144_wal_encode_append_pair_profile_status=ok +phase145_wal_record_materialization_reduction_status=ok +wal_record_materialization_change=writebatch_value_entries +unit_record_compatibility=pass candidate_max_h2c_bytes=65536 target_write_request_max_bytes=65536 backend_write_request_max_bytes=65536 -wal_encode_ops=143573 -wal_encode_bytes=593530782 -wal_encode_duration_ms=297 -wal_append_ops=9009 -wal_append_bytes=593543918 -wal_append_duration_ms=295 -wal_append_writeat_calls=9009 -wal_append_writeat_avg_bytes=65883 -phase144_pair_shape=encode_append_tied -phase144_decision=continue_backend_work -next_recommendation=phase145_wal_record_materialization_reduction +wal_encode_duration_ms=285 +wal_append_duration_ms=293 +writer_verified=true +reader_verified=true +phase145_decision=keep_change +next_recommendation=phase146_wal_record_materialization_effectiveness_profile cleanup_status=ok ``` ## Goal -Reduce one concrete WAL record materialization cost without changing WAL -durability semantics. - -```text -identify a local encode/copy allocation or data-copy seam --> add a narrow unit regression for record bytes and recovery compatibility --> implement the smallest safe reduction --> keep 64KiB H2C request-shape assertions --> live profile shows mounted writer/reader still passes --> cleanup remains clean -``` +Measure whether the Phase 145 allocation reduction is visible enough to keep as +a meaningful backend optimization, or whether the next work must move to deeper +WAL format/vectored-I/O design. ## Required Evidence ```text -phase145_wal_record_materialization_reduction_status=ok +phase146_wal_record_materialization_effectiveness_status=ok frontend_transport=tcp roce_claim_allowed=false nvme_rdma_claim_allowed=false performance_slo_claim_allowed=false candidate_max_h2c_bytes=65536 -wal_record_materialization_change= -unit_record_compatibility=pass target_write_request_max_bytes=65536 backend_write_request_max_bytes=65536 +wal_record_materialization_change=writebatch_value_entries +unit_record_compatibility=pass wal_encode_duration_ms= wal_append_duration_ms= -writer_verified=true -reader_verified=true -phase145_decision= +phase146_effectiveness= +phase146_decision= next_recommendation= cleanup_status=ok ``` ## Boundaries -- Do not change WAL on-disk format unless a compatibility test proves old data - can still recover. -- Do not weaken CRC/checksum or SmartWAL integrity behavior. -- Do not claim performance/SLO, RoCE, NVMe/RDMA, GPU Direct, cuFile/cuObject, - or NIXL. +- Do not claim throughput/SLO from one noisy lab profile. +- Do not change WAL on-disk format or use platform-specific vectored I/O in + this phase. - Do not raise the default H2C size. +- Keep the 64KiB H2C path as explicit opt-in lab evidence. ## Candidate Work -1. Inspect WAL encode/append code for a single redundant allocation/copy seam. -2. Prefer a local helper change with before/after unit coverage. -3. If no safe seam exists, close as `blocked` with explicit code evidence - rather than speculative optimization. -4. Re-run the large-H2C profile to ensure request shape and mounted I/O remain - correct. +1. Re-run the large-H2C profile and compare against Phase 144/145 evidence. +2. Classify the change as visible, not visible, or inconclusive. +3. If not visible/inconclusive, name the next design gate explicitly: + multi-block WAL records or vectored pwrite. ## Exit Criteria -Phase 145 can close when a narrow materialization reduction is implemented and -validated, or when the phase proves no safe local seam exists without deeper -WAL format work. +Phase 146 can close when it either justifies keeping the local allocation +reduction as visible, or redirects future work to a deeper WAL design gate +without making a performance claim. diff --git a/seaweed-block/internal/docs/finished-plans/phase145_finishedplan_wal_record_materialization_reduction.md b/seaweed-block/internal/docs/finished-plans/phase145_finishedplan_wal_record_materialization_reduction.md new file mode 100644 index 0000000000..a39d44ecbf --- /dev/null +++ b/seaweed-block/internal/docs/finished-plans/phase145_finishedplan_wal_record_materialization_reduction.md @@ -0,0 +1,57 @@ +# Phase 145 Finished Plan: WAL Record Materialization Reduction + +Status: **closed 2026-07-06, live gate PASS**. + +## Problem + +Phase 144 showed WAL encode and append were tied under the 64KiB H2C opt-in. +The next implementation step needed to be narrow and safe: reduce a local +materialization cost without changing WAL durability semantics. + +## Work + +Phase 145 changed the WAL batch materialization path: + +- before: `WALStore.WriteBatch` allocated a `*walEntry` per block; +- after: it creates one `[]walEntry` value slice and the WAL writer consumes + each entry by address while encoding. + +This avoids per-record pointer/object allocation while preserving the same WAL +record bytes and write-at batching. + +The phase added: + +- `scripts/run-phase145-wal-record-materialization-reduction-gate.sh`; +- `testops/scenarios/nvme-tcp-wal-record-materialization-reduction-chain.yaml`. + +## Evidence + +```text +phase145_wal_record_materialization_reduction_status=ok +wal_record_materialization_change=writebatch_value_entries +unit_record_compatibility=pass +candidate_max_h2c_bytes=65536 +target_write_request_max_bytes=65536 +backend_write_request_max_bytes=65536 +wal_encode_duration_ms=285 +wal_append_duration_ms=293 +writer_verified=true +reader_verified=true +phase145_decision=keep_change +next_recommendation=phase146_wal_record_materialization_effectiveness_profile +cleanup_status=ok +``` + +Run bundle: + +```text +results\20260706-152811-0a23 +36 actions: 36 passed, 0 failed +``` + +## Conclusion + +The safe local allocation reduction can stay. It should not be marketed as a +performance win until Phase 146 measures before/after effectiveness. Larger +reductions probably require either WAL format work or vectored I/O, both of +which need separate design gates. diff --git a/seaweed-block/internal/docs/product-roadmap.md b/seaweed-block/internal/docs/product-roadmap.md index e36f6d7733..8ea86c9a17 100644 --- a/seaweed-block/internal/docs/product-roadmap.md +++ b/seaweed-block/internal/docs/product-roadmap.md @@ -470,6 +470,11 @@ rebuild, delete safety, or cleanup must start as a separate gated phase. gate showed `wal_encode_duration_ms=297` and `wal_append_duration_ms=295`, so the next implementation target is a narrow WAL record materialization reduction rather than isolated append or encode tuning. +- Phase 145 is closed for the first WAL materialization reduction. The batch + path now uses `[]walEntry` values instead of allocating one `*walEntry` per + block, preserving WAL bytes/recovery while removing a local allocation seam. + The next phase should measure whether this is visible or whether deeper WAL + format/vectored-I/O work is required. - Later protocol candidates: complete a real NVMe/RDMA target, characterize NVMe/TCP performance, or bridge to object/NIXL acceleration where the product surface is object/storage rather than block PVC. Keep these separate so diff --git a/seaweed-block/internal/docs/qa-assignments/phase145-wal-record-materialization-reduction-qa-signoff.md b/seaweed-block/internal/docs/qa-assignments/phase145-wal-record-materialization-reduction-qa-signoff.md new file mode 100644 index 0000000000..d52872e3e0 --- /dev/null +++ b/seaweed-block/internal/docs/qa-assignments/phase145-wal-record-materialization-reduction-qa-signoff.md @@ -0,0 +1,68 @@ +# Phase 145 QA Sign-Off: WAL Record Materialization Reduction + +Status: **PASS**. + +Validated source tree: `phase145-wal-record-materialization-reduction`, synced +to `/tmp/seaweed_block` on m02 as clean Phase 144 HEAD plus the Phase 145 code +and gate overlay. + +Run command: + +```text +C:\work\swblock.exe run testops/scenarios/nvme-tcp-wal-record-materialization-reduction-chain.yaml ` + -output results\phase145-materialization-run1.json ` + -html results\phase145-materialization-run1.html +``` + +Run bundle: + +```text +results\20260706-152811-0a23 +36 actions: 36 passed, 0 failed +``` + +## Change + +`WALStore.WriteBatch` now builds WAL records as a `[]walEntry` value slice +instead of allocating one `*walEntry` per block. The WAL writer consumes the +values by address while encoding the batch. + +This removes per-record pointer/object allocation in the batch materialization +path. It does not change: + +- WAL on-disk record layout; +- CRC/checksum coverage; +- caller-buffer copy semantics; +- recovery semantics; +- pwrite batching behavior. + +## Evidence + +```text +phase145_wal_record_materialization_reduction_status=ok +frontend_transport=tcp +roce_claim_allowed=false +nvme_rdma_claim_allowed=false +performance_slo_claim_allowed=false +candidate_max_h2c_bytes=65536 +wal_record_materialization_change=writebatch_value_entries +unit_record_compatibility=pass +helm_candidate_max_h2c_data_length=65536 +target_write_request_max_bytes=65536 +backend_write_request_max_bytes=65536 +wal_encode_duration_ms=285 +wal_append_duration_ms=293 +writer_verified=true +reader_verified=true +phase145_decision=keep_change +next_recommendation=phase146_wal_record_materialization_effectiveness_profile +cleanup_status=ok +``` + +## Verdict + +The narrow materialization reduction is safe to keep. The live gate proves the +large-H2C mounted path still works and the request shape remains 64KiB. The +phase does not claim throughput improvement; Phase 146 should measure whether +the allocation reduction is visible or whether deeper WAL format/writev work is +needed. diff --git a/seaweed-block/scripts/run-phase145-wal-record-materialization-reduction-gate.sh b/seaweed-block/scripts/run-phase145-wal-record-materialization-reduction-gate.sh new file mode 100644 index 0000000000..720375abe5 --- /dev/null +++ b/seaweed-block/scripts/run-phase145-wal-record-materialization-reduction-gate.sh @@ -0,0 +1,147 @@ +#!/usr/bin/env bash +set -euo pipefail + +ROOT="${1:-$(pwd)}" +ARTIFACT_DIR="${SW_BLOCK_ARTIFACT_DIR:-${ROOT}/results/phase145-wal-record-materialization-reduction-gate}" +SUMMARY="${ARTIFACT_DIR}/phase145-wal-record-materialization-reduction-summary.txt" +PHASE126_DIR="${ARTIFACT_DIR}/phase126-profile" +CANDIDATE_MAX_H2C_BYTES="${SW_BLOCK_PHASE145_CANDIDATE_MAX_H2C_BYTES:-65536}" +SEQ_MIB="${SW_BLOCK_PHASE145_SEQ_MIB:-512}" +MATERIALIZATION_CHANGE="${SW_BLOCK_PHASE145_MATERIALIZATION_CHANGE:-writebatch_value_entries}" + +mkdir -p "${ARTIFACT_DIR}" "${PHASE126_DIR}" +: >"${SUMMARY}" + +write_summary() { + echo "$*" | tee -a "${SUMMARY}" >/dev/null +} + +summary_value() { + local file="$1" + local key="$2" + awk -F= -v key="$key" '$1 == key {value = substr($0, length(key) + 2)} END {if (value != "") print value}' "$file" +} + +require_summary_value() { + local file="$1" + local key="$2" + local value + value="$(summary_value "$file" "$key")" + if [[ -z "${value}" ]]; then + echo "missing summary key ${key} in ${file}" >&2 + exit 1 + fi + printf '%s' "${value}" +} + +assert_int_eq() { + local actual="$1" + local want="$2" + local label="$3" + python3 - "$actual" "$want" "$label" <<'PY' +import sys +actual = int(sys.argv[1]) +want = int(sys.argv[2]) +label = sys.argv[3] +if actual != want: + raise SystemExit(f"{label}={actual}, want {want}") +PY +} + +assert_int_ge() { + local actual="$1" + local want="$2" + local label="$3" + python3 - "$actual" "$want" "$label" <<'PY' +import sys +actual = int(sys.argv[1]) +want = int(sys.argv[2]) +label = sys.argv[3] +if actual < want: + raise SystemExit(f"{label}={actual}, want >= {want}") +PY +} + +float_gt_zero() { + python3 - "$1" <<'PY' +import sys +try: + v = float(sys.argv[1]) +except ValueError: + v = 0 +print(str(v > 0).lower()) +PY +} + +write_summary "phase145_wal_record_materialization_reduction_status=running" +write_summary "frontend_transport=tcp" +write_summary "roce_claim_allowed=false" +write_summary "nvme_rdma_claim_allowed=false" +write_summary "performance_slo_claim_allowed=false" +write_summary "candidate_max_h2c_bytes=${CANDIDATE_MAX_H2C_BYTES}" +write_summary "wal_record_materialization_change=${MATERIALIZATION_CHANGE}" + +cd "${ROOT}" +go test ./core/storage ./core/frontend/durable \ + >"${ARTIFACT_DIR}/go-test-record-compatibility.log" \ + 2>&1 +write_summary "unit_record_compatibility=pass" + +SW_BLOCK_ARTIFACT_DIR="${PHASE126_DIR}" \ +SW_BLOCK_PHASE126_SEQ_MIB="${SEQ_MIB}" \ +SW_BLOCK_NVME_MAX_H2C_DATA_LENGTH="${CANDIDATE_MAX_H2C_BYTES}" \ + bash "${ROOT}/scripts/run-phase126-block-nvme-tcp-backend-write-instrumentation-gate.sh" "${ROOT}" \ + >"${ARTIFACT_DIR}/phase126-profile.stdout.txt" \ + 2>"${ARTIFACT_DIR}/phase126-profile.stderr.txt" + +PHASE126_SUMMARY="${PHASE126_DIR}/phase126-block-nvme-tcp-backend-write-instrumentation-summary.txt" +PHASE120_SUMMARY="${PHASE126_DIR}/phase125-profile/block-profile/phase120-nvme-tcp-performance-baseline-summary.txt" +if [[ "$(require_summary_value "${PHASE126_SUMMARY}" phase126_block_nvme_tcp_backend_write_instrumentation_status)" != "ok" ]]; then + echo "phase126 profile dependency did not finish ok" >&2 + exit 1 +fi +if [[ "$(require_summary_value "${PHASE120_SUMMARY}" phase120_nvme_tcp_performance_baseline_status)" != "ok" ]]; then + echo "phase120 candidate profile did not finish ok" >&2 + exit 1 +fi + +HELM_H2C="$(require_summary_value "${PHASE120_SUMMARY}" nvme_max_h2c_data_length)" +SEQ_WRITE_MIBPS="$(require_summary_value "${PHASE120_SUMMARY}" seq_write_mibps)" +SEQ_READ_MIBPS="$(require_summary_value "${PHASE120_SUMMARY}" seq_read_mibps)" +WRITER_VERIFIED="$(float_gt_zero "${SEQ_WRITE_MIBPS}")" +READER_VERIFIED="$(float_gt_zero "${SEQ_READ_MIBPS}")" +TARGET_WRITE_REQUEST_MAX_BYTES="$(require_summary_value "${PHASE126_SUMMARY}" target_write_request_max_bytes)" +BACKEND_WRITE_REQUEST_MAX_BYTES="$(require_summary_value "${PHASE126_SUMMARY}" backend_write_request_max_bytes)" +WAL_ENCODE_MS="$(require_summary_value "${PHASE126_SUMMARY}" wal_encode_duration_ms)" +WAL_APPEND_MS="$(require_summary_value "${PHASE126_SUMMARY}" wal_append_duration_ms)" +CLEANUP_STATUS="$(require_summary_value "${PHASE126_SUMMARY}" cleanup_status)" + +assert_int_eq "${HELM_H2C}" "${CANDIDATE_MAX_H2C_BYTES}" "helm_candidate_max_h2c_data_length" +assert_int_eq "${TARGET_WRITE_REQUEST_MAX_BYTES}" "${CANDIDATE_MAX_H2C_BYTES}" "target_write_request_max_bytes" +assert_int_eq "${BACKEND_WRITE_REQUEST_MAX_BYTES}" "${CANDIDATE_MAX_H2C_BYTES}" "backend_write_request_max_bytes" +assert_int_ge "${WAL_ENCODE_MS}" 1 "wal_encode_duration_ms" +assert_int_ge "${WAL_APPEND_MS}" 1 "wal_append_duration_ms" +if [[ "${WRITER_VERIFIED}" != "true" ]]; then + echo "writer_verified=${WRITER_VERIFIED}, want true" >&2 + exit 1 +fi +if [[ "${READER_VERIFIED}" != "true" ]]; then + echo "reader_verified=${READER_VERIFIED}, want true" >&2 + exit 1 +fi +if [[ "${CLEANUP_STATUS}" != "ok" ]]; then + echo "cleanup_status=${CLEANUP_STATUS}, want ok" >&2 + exit 1 +fi + +write_summary "helm_candidate_max_h2c_data_length=${HELM_H2C}" +write_summary "target_write_request_max_bytes=${TARGET_WRITE_REQUEST_MAX_BYTES}" +write_summary "backend_write_request_max_bytes=${BACKEND_WRITE_REQUEST_MAX_BYTES}" +write_summary "wal_encode_duration_ms=${WAL_ENCODE_MS}" +write_summary "wal_append_duration_ms=${WAL_APPEND_MS}" +write_summary "writer_verified=${WRITER_VERIFIED}" +write_summary "reader_verified=${READER_VERIFIED}" +write_summary "phase145_decision=keep_change" +write_summary "next_recommendation=phase146_wal_record_materialization_effectiveness_profile" +write_summary "cleanup_status=${CLEANUP_STATUS}" +write_summary "phase145_wal_record_materialization_reduction_status=ok" diff --git a/seaweed-block/testops/scenarios/nvme-tcp-wal-record-materialization-reduction-chain.yaml b/seaweed-block/testops/scenarios/nvme-tcp-wal-record-materialization-reduction-chain.yaml new file mode 100644 index 0000000000..93e006116c --- /dev/null +++ b/seaweed-block/testops/scenarios/nvme-tcp-wal-record-materialization-reduction-chain.yaml @@ -0,0 +1,175 @@ +name: nvme-tcp-wal-record-materialization-reduction-chain +timeout: 90m + +env: + product_root: "/tmp/seaweed_block" + ssh_key: "C:\\work\\dev_server\\testdev_key" + +topology: + nodes: + m02: + host: 192.168.1.184 + user: testdev + key: "{{ ssh_key }}" + +phases: + - name: pre_clean + actions: + - action: pre_run_cleanup + node: m02 + kill_patterns: "blockmaster,blockvolume,blockcsi,iscsi-target" + nvme_disconnect: "true" + iscsi_logout_prefix: "iqn.2026-05.io.seaweedfs" + - action: exec + node: m02 + timeout: 5m + cmd: "helm status sw-block --namespace kube-system >/dev/null 2>&1 && helm uninstall sw-block --namespace kube-system --wait --timeout 240s || true; kubectl -n default delete pod sw-block-phase126-block-perf sw-block-phase126-local-perf --ignore-not-found=true --wait=true --timeout=60s || true; kubectl -n default delete pvc sw-block-phase126-block-pvc sw-block-phase126-local-pvc --ignore-not-found=true --wait=true --timeout=60s || true; kubectl delete storageclass sw-block-phase126-block --ignore-not-found=true --wait=true --timeout=60s || true; kubectl get pv --no-headers | awk '/sw-block-phase126/ {print $1}' | xargs -r -n1 kubectl patch pv --type=merge -p '{\"metadata\":{\"finalizers\":[]}}' >/dev/null 2>&1 || true; kubectl get pv --no-headers | awk '/sw-block-phase126/ {print $1}' | xargs -r kubectl delete pv --wait=false >/dev/null 2>&1 || true; kubectl -n kube-system get swblockvolumes.block.seaweedfs.com -o name 2>/dev/null | xargs -r -n1 kubectl -n kube-system patch --type=merge -p '{\"metadata\":{\"finalizers\":[]}}' >/dev/null 2>&1 || true; kubectl -n kube-system delete swblockvolumes.block.seaweedfs.com --all --ignore-not-found=true --wait=true --timeout=60s >/dev/null 2>&1 || true; kubectl -n kube-system delete swblockclusters.block.seaweedfs.com --all --ignore-not-found=true --wait=true --timeout=60s >/dev/null 2>&1 || true; kubectl delete validatingadmissionpolicy,validatingadmissionpolicybinding -l app.kubernetes.io/instance=sw-block --ignore-not-found=true >/dev/null 2>&1 || true; kubectl delete crd swblockclusters.block.seaweedfs.com swblockvolumes.block.seaweedfs.com swblockreplicaeligibilities.block.seaweedfs.com swblockreplicarebuilds.block.seaweedfs.com swblockreplicafailbacks.block.seaweedfs.com swblockfrontendpublications.block.seaweedfs.com --ignore-not-found=true --wait=true --timeout=60s >/dev/null 2>&1 || true; sudo -n nvme disconnect-all >/dev/null 2>&1 || true; rm -rf /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase145-materialization && mkdir -p /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase145-materialization" + env.KUBECONFIG: "/etc/rancher/k3s/k3s.yaml" + + - name: run_gate + actions: + - action: exec + node: m02 + timeout: 82m + cmd: "cd {{ product_root }} && SW_BLOCK_ARTIFACT_DIR=/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase145-materialization SW_BLOCK_PHASE145_CANDIDATE_MAX_H2C_BYTES=65536 SW_BLOCK_PHASE145_SEQ_MIB=512 SW_BLOCK_PHASE125_FRONTEND_IP_MAP=m01=10.0.0.1,m02=10.0.0.3 SW_BLOCK_PHASE125_EXPECTED_ROUTE_DEV=enp1s0np0 SW_BLOCK_IMPORT_K3S_SSH_KEY=/opt/work/testdev_key bash scripts/run-phase145-wal-record-materialization-reduction-gate.sh {{ product_root }}" + env.KUBECONFIG: "/etc/rancher/k3s/k3s.yaml" + + - name: assert_summary + actions: + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase145-materialization/phase145-wal-record-materialization-reduction-summary.txt" + pattern: "^phase145_wal_record_materialization_reduction_status=ok$" + save_as: phase145_status_ok + - action: assert_greater + actual: "{{ phase145_status_ok }}" + threshold: "0" + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase145-materialization/phase145-wal-record-materialization-reduction-summary.txt" + pattern: "^wal_record_materialization_change=writebatch_value_entries$" + save_as: materialization_change + - action: assert_greater + actual: "{{ materialization_change }}" + threshold: "0" + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase145-materialization/phase145-wal-record-materialization-reduction-summary.txt" + pattern: "^unit_record_compatibility=pass$" + save_as: unit_compat + - action: assert_greater + actual: "{{ unit_compat }}" + threshold: "0" + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase145-materialization/phase145-wal-record-materialization-reduction-summary.txt" + pattern: "^roce_claim_allowed=false$" + save_as: no_roce_claim + - action: assert_greater + actual: "{{ no_roce_claim }}" + threshold: "0" + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase145-materialization/phase145-wal-record-materialization-reduction-summary.txt" + pattern: "^nvme_rdma_claim_allowed=false$" + save_as: no_rdma_claim + - action: assert_greater + actual: "{{ no_rdma_claim }}" + threshold: "0" + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase145-materialization/phase145-wal-record-materialization-reduction-summary.txt" + pattern: "^performance_slo_claim_allowed=false$" + save_as: no_slo_claim + - action: assert_greater + actual: "{{ no_slo_claim }}" + threshold: "0" + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase145-materialization/phase145-wal-record-materialization-reduction-summary.txt" + pattern: "^candidate_max_h2c_bytes=65536$" + save_as: candidate_64k + - action: assert_greater + actual: "{{ candidate_64k }}" + threshold: "0" + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase145-materialization/phase145-wal-record-materialization-reduction-summary.txt" + pattern: "^target_write_request_max_bytes=65536$" + save_as: target_h2c + - action: assert_greater + actual: "{{ target_h2c }}" + threshold: "0" + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase145-materialization/phase145-wal-record-materialization-reduction-summary.txt" + pattern: "^backend_write_request_max_bytes=65536$" + save_as: backend_h2c + - action: assert_greater + actual: "{{ backend_h2c }}" + threshold: "0" + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase145-materialization/phase145-wal-record-materialization-reduction-summary.txt" + pattern: "^wal_encode_duration_ms=[1-9][0-9]*$" + save_as: encode_ms + - action: assert_greater + actual: "{{ encode_ms }}" + threshold: "0" + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase145-materialization/phase145-wal-record-materialization-reduction-summary.txt" + pattern: "^wal_append_duration_ms=[1-9][0-9]*$" + save_as: append_ms + - action: assert_greater + actual: "{{ append_ms }}" + threshold: "0" + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase145-materialization/phase145-wal-record-materialization-reduction-summary.txt" + pattern: "^writer_verified=true$" + save_as: writer_verified + - action: assert_greater + actual: "{{ writer_verified }}" + threshold: "0" + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase145-materialization/phase145-wal-record-materialization-reduction-summary.txt" + pattern: "^reader_verified=true$" + save_as: reader_verified + - action: assert_greater + actual: "{{ reader_verified }}" + threshold: "0" + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase145-materialization/phase145-wal-record-materialization-reduction-summary.txt" + pattern: "^phase145_decision=keep_change$" + save_as: decision_keep + - action: assert_greater + actual: "{{ decision_keep }}" + threshold: "0" + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase145-materialization/phase145-wal-record-materialization-reduction-summary.txt" + pattern: "^next_recommendation=phase146_.*$" + save_as: next_named + - action: assert_greater + actual: "{{ next_named }}" + threshold: "0" + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase145-materialization/phase145-wal-record-materialization-reduction-summary.txt" + pattern: "^cleanup_status=ok$" + save_as: cleanup_ok + - action: assert_greater + actual: "{{ cleanup_ok }}" + threshold: "0" + + - name: collect + always: true + actions: + - action: collect_path + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase145-materialization" + name: "remote-phases" + ignore_error: true