ref:main
#!/usr/bin/env bash
# Regenerate the read-path source-of-truth table (bench/RESULTS.md).
#
# Produces five columns via `mix exgo.bench`: native git, FS (local), FS on
# CephFS, S3/MinIO, S3/Ceph RGW. Each column is one JSON file; the render step
# merges them into a markdown table.
#
# Prereqs:
# - A packed git repo on local disk at $REPO_DIR (also an ExGitObjectstore
# Filesystem layout: $ROOT/repos/$ID).
# - MinIO + Ceph RGW reachable with the repo migrated into a bucket.
# - For the CephFS column: the cephfs-bench container (see anvil
# priv/repro/cephfs-bench/) with CephFS mounted at /cephfs and the repo
# copied to /cephfs/repos/$ID.
#
# Usage: ROOT=/path/to/repo_data ID=<uuid> OUT=/tmp/bench ./bench/run_all.sh
set -euo pipefail
ROOT="${ROOT:?set ROOT=<dir containing repos/<id>>}"
ID="${ID:?set ID=<repo uuid>}"
OUT="${OUT:-/tmp/exgo-bench}"
mkdir -p "$OUT"
RID="$ROOT/repos/$ID"
# Derive ONE fixture from the git repo so every column measures identical inputs.
HEAD=$(git -C "$RID" rev-parse HEAD)
OLD=$(git -C "$RID" rev-parse "HEAD~${DEPTH:-50}")
LS=$(git -C "$RID" ls-tree HEAD)
BLOBLINE=$(echo "$LS" | awk '$2=="blob"{print; exit}')
BLOB=$(echo "$BLOBLINE" | awk '{print $3}')
FILE=$(echo "$BLOBLINE" | cut -f2)
SUBDIR=$(echo "$LS" | awk '$2=="tree"{print; exit}' | cut -f2)
FX="--head $HEAD --old $OLD --file $FILE --blob $BLOB --subdir $SUBDIR --runs 3 --op-timeout 60000"
echo "fixture: HEAD=$HEAD OLD=$OLD FILE=$FILE SUBDIR=$SUBDIR"
mix exgo.bench --target git --git-dir "$RID" $FX --label "native git" --out "$OUT/git.json"
mix exgo.bench --target filesystem --root "$ROOT" --repo "$ID" $FX --label "FS (local)" --out "$OUT/fs.json"
if [ -n "${MINIO:-}" ]; then
mix exgo.bench --target s3 --bucket "${MINIO_BUCKET:-anvil-git-packed}" --repo "$ID" \
--s3-host "${MINIO_HOST:-localhost}" --s3-port "${MINIO_PORT:-9000}" \
--s3-key "${MINIO_KEY:-minioadmin}" --s3-secret "${MINIO_SECRET:-minioadmin}" \
$FX --label "S3 / MinIO" --out "$OUT/minio.json"
fi
if [ -n "${CEPH_RGW:-}" ]; then
mix exgo.bench --target s3 --bucket "${RGW_BUCKET:-anvil-git-packed}" --repo "$ID" \
--s3-host "${RGW_HOST:-localhost}" --s3-port "${RGW_PORT:-8080}" \
--s3-key "${RGW_KEY:-cephadmin}" --s3-secret "${RGW_SECRET:-cephadmin123}" \
$FX --label "S3 / Ceph RGW" --out "$OUT/ceph-rgw.json"
fi
# CephFS column runs inside the cephfs-bench container; emit the same flags:
echo
echo "# CephFS column (run inside the cephfs-bench container):"
echo "mix exgo.bench --target filesystem --root /cephfs --repo $ID $FX --label 'FS on CephFS' --out /tmp/cephfs.json"
echo
echo "# Then render:"
echo "mix exgo.bench --render $OUT/git.json $OUT/fs.json <cephfs.json> $OUT/minio.json $OUT/ceph-rgw.json"