From 28055a8551e9d6b7fc8a94505a50e6f8d941a38f Mon Sep 17 00:00:00 2001 From: Artyom Date: Wed, 28 Oct 2026 22:40:56 +0300 Subject: [PATCH] Pass the upload limits to the API and check the console from the network The API replicas get UPLOAD_CONCURRENCY, UPLOAD_GRACE_SECONDS, UPLOAD_SWEEP_INTERVAL_SECONDS and UPLOAD_SWEEP_BATCH through the S3 anchor of compose.yaml with the same defaults as the settings, and .env.example documents them. A value in the shell overrides the default, which the memory experiment uses to recreate the replicas with a different number of slots. s3-check.sh now also asks the console port of the S3 service from a separate container on the stand network and expects a refused connection, so 23 checks cover ports, the console inside and outside the container, the repeated bootstrap, the rights of the API key and anonymous access. Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_01V1d3RLHNBBMA6UqBLLJv27 --- .env.example | 6 ++++++ compose.yaml | 4 ++++ openspec/changes/add-lab4-upload-resilience/tasks.md | 6 +++--- scripts/s3-check.sh | 4 ++++ 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/.env.example b/.env.example index 7f565633..d22be469 100644 --- a/.env.example +++ b/.env.example @@ -42,3 +42,9 @@ S3_CONNECT_TIMEOUT_SECONDS=1 S3_READ_TIMEOUT_SECONDS=2 IMAGE_CHECK_CONCURRENCY=2 S3_MEMORY=512m +# Solution-specific for lab4 grade 4: upload bodies buffered at once per worker, grace period +# before an abandoned pending upload is swept, sweep interval and rows per sweep pass. +UPLOAD_CONCURRENCY=3 +UPLOAD_GRACE_SECONDS=900 +UPLOAD_SWEEP_INTERVAL_SECONDS=30 +UPLOAD_SWEEP_BATCH=100 diff --git a/compose.yaml b/compose.yaml index de8050d3..ad30848a 100644 --- a/compose.yaml +++ b/compose.yaml @@ -13,6 +13,10 @@ x-s3-env: &s3-env MAX_UPLOAD_BYTES: ${MAX_UPLOAD_BYTES:-10485760} MAX_IMAGE_PIXELS: ${MAX_IMAGE_PIXELS:-40000000} IMAGE_CHECK_CONCURRENCY: ${IMAGE_CHECK_CONCURRENCY:-2} + UPLOAD_CONCURRENCY: ${UPLOAD_CONCURRENCY:-3} + UPLOAD_GRACE_SECONDS: ${UPLOAD_GRACE_SECONDS:-900} + UPLOAD_SWEEP_INTERVAL_SECONDS: ${UPLOAD_SWEEP_INTERVAL_SECONDS:-30} + UPLOAD_SWEEP_BATCH: ${UPLOAD_SWEEP_BATCH:-100} x-s3-client: &s3-client image: rustfs/rc:v0.1.36@sha256:ab024bfebee49a750ce886b4c70963ccd9ddaa03f491704a90710641d7a26699 diff --git a/openspec/changes/add-lab4-upload-resilience/tasks.md b/openspec/changes/add-lab4-upload-resilience/tasks.md index 87c77bdd..b2323727 100644 --- a/openspec/changes/add-lab4-upload-resilience/tasks.md +++ b/openspec/changes/add-lab4-upload-resilience/tasks.md @@ -16,9 +16,9 @@ ## 3. Стенд -- [ ] 3.1 `compose.yaml` и `.env.example`: новые переменные зоны у `api` -- [ ] 3.2 `scripts/s3-check.sh`: консоль из сети стенда -- [ ] 3.3 Проверка группы: `docker compose config --quiet`, `make up`, `make test` +- [x] 3.1 `compose.yaml` и `.env.example`: новые переменные зоны у `api` +- [x] 3.2 `scripts/s3-check.sh`: консоль из сети стенда +- [x] 3.3 Проверка группы: `docker compose config --quiet`, `make up`, `make test` ## 4. Проверки против стенда diff --git a/scripts/s3-check.sh b/scripts/s3-check.sh index fb6c6db8..fa1bdaec 100755 --- a/scripts/s3-check.sh +++ b/scripts/s3-check.sh @@ -54,6 +54,10 @@ if [ "$status" = 403 ]; then echo "PASS anonymous: прямой HTTP GET объ permission=$(rc bucket anonymous get "root/$b" --json | sed -n 's/.*"permission": *"\([a-z]*\)".*/\1/p') if [ "$permission" = private ]; then echo "PASS bucket: anonymous policy: $permission"; else echo "FAIL bucket: anonymous policy: $permission"; result=1; fi expect allow "api: DeleteObject" rc object remove --force "api/$b/$key" +host=$(echo "$S3_ENDPOINT" | sed 's#^[a-z]*://##; s#:.*##') +if wget -T 2 -O /dev/null "http://$host:9001/" >/tmp/out 2>&1; then echo "FAIL s3: консоль :9001 отвечает из сети стенда"; result=1 +elif grep -q refused /tmp/out; then echo "PASS s3: консоль :9001 из отдельного контейнера сети стенда: connection refused" +else echo "FAIL s3: консоль :9001 из сети стенда: $(tail -n 1 /tmp/out)"; result=1; fi exit $result EOF echo "== IAM/bucket snapshot (без секретов)"