LLM WikiAccess-protected knowledge portal

WIKI

binlog-transfer-system

AI Summary Purpose Store repository specific architecture, verification commands, and review constraints for the BTS v4 binlog transfer system. Key points download server is a Python/FastAPI encrypted binlog HTTP server with direct, proxy,

경로ai/repo-notes/binlog-transfer-system.md
카테고리Repo Note
태그#binlog #bts #cicd #crawler #fastapi #go #infra #kubernetes #mysql #notes #repo #repo-note #report #security #system #transfer

# binlog-transfer-system

AI Summary

Purpose:

constraints for the BTS v4 binlog transfer system.

Key points:

direct, proxy, and relay modes.

binlog files to the target database.

cf904ad ended in Request changes; the branch was not modified.

Smart Polling header, and core 200/202/304 flow, but misses direct POST operational status logs, uses coercive identifier parsing, and has no behavioral regression coverage.

updater) all run the same image with different command values, so image-level changes apply to all three.

8.21.0 build for BT26-707. mysqld never linked libcurl; only microdnf/librepo/libdnf and mysql-shell did.

Relevant when:

proxy/relay behavior, updater configuration, or release packaging.

Do not read full document unless:

are required.

Linked documents:

Repo Info

Common Commands

git diff origin/main...HEAD
git diff --check origin/main...HEAD

cd updater
go test -race -shuffle=on -count=1 ./...
go vet ./...

cd ../download-server
PYTHONDONTWRITEBYTECODE=1 uv run --no-project \
  --with-requirements requirements.txt python -c \
  'from app.routers.cdbvdb_v4 import BtsDownloadBody; print(BtsDownloadBody)'

Architecture Notes

direct encrypted streaming, proxy pass-through, relay status forwarding, Smart Polling, and active-file protection.

updater success/error log reads status, reason, and msg only from query parameters.

verifies X-Original-Hash, and updates persisted download state.

PyInstaller download-server binary into the unified MySQL-based image.

lab-master-db, download-proxy-server and updater from the same labradorlabs/master-bts:<ver> image; entrypoint.sh dispatches on the command (mysqld default / server / updater). An image-level fix applies to all three at once.

curl/libcurl, mysql-shell, microdnf and openssl.

librepo.so.0, libdnf.so.2, mysqlsh, mysql-secret-store-login-path, curl. mysqld does not link libcurl, and no MySQL plugin or /app binary references it (including via dlopen). Nothing in the repo invokes curl or mysqlsh.

el9 RPM. curl-builder is a stage FROM mysql:8.4.0 and both stages run microdnf update -y openssl-libs zlib so the runtime libs match.

Known Pitfalls

the query-only operational status logger unless logging is moved to a shared parsed-request seam.

integers. Use strict types when GET/POST identifier semantics must match.

field/list bounds, and bounded relay concurrency before exposing POST to a reachable network.

FastAPI/Pydantic behavior can drift between image builds.

read-only imports can fail even when router-level syntax/model checks pass; this is pre-existing and was not attributed to the POST branch.

define a new image version and migration/release plan, especially because security-tool keys are embedded at build time.

into decryptor (wrapped), ops_connect and the server-side encryptor; with no argument it silently generates a random key ("development only"), and a mismatched key breaks customer-side decryption. /config/ and /bin/ are gitignored and absent from the checkout.

missing, and reuses whatever is there on the next run. Never run build.sh for a throwaway/validation build — call docker build directly with a temp --secret, or a later production build will silently pick up the dev keys.

enough. curl/libcurl come from the base too; rpm -q --last distinguishes base packages (2024 build date) from ones our layer installed or upgraded.

final stage. Building curl on oraclelinux:9 produced libssl.so.3: version 'OPENSSL_3.2.0' not found because that base's OpenSSL was newer than the target's. Keep the DT_NEEDED set minimal for the same reason.

layers and the rewritten rpmdb is added on top (an in-place removal patch of 4.0.0 measured 1.37GB → 1.39GB).

(uid 1000)**. scripts/lib/common.sh:119 sets UID_GID=$(id -u):$(id -g), so the container inherits the invoking user; running as another account makes mysqld fail on /var/log/mysql/error.log and /data/lab-master (both owned by 1000:1000) and the container crash-loops. Recovery without that account: pass UID_GID=1000:1000 in the environment to docker compose up -d — shell env outranks --env-file in Compose v2.

based only on the compose exit code. It does not verify mysqld stayed up, so always check docker ps and the error log after a start.

in docker-compose.yml. The updater pins its tag in docker-compose.yml directly. A version rollout has to touch both.

Current Work

main is at 3aca7f1 (v4.1.0 released; the POST branch was merged in 36acaa0). Uncommitted on top: UnifiedDockerfile (curl-builder stage + el9 curl/libcurl replacement + build-time assertions), VERSION4.1.1, new RELEASE/v4.1.1.md. Validated with a linux/amd64 build using a throwaway key; a release image still needs the production SECRET_KEY.

against cf904ad on 2026-08-03 with Request changes. It was merged anyway as part of v4.1.0 (36acaa0, 85f8fb2); the review findings were not re-checked against the merged code.

Decisions

validation, body/relay resource bounds, and cross-boundary tests are added.

hops as an explicit topology decision rather than an assumption.

Open Questions

also to BTS proxy/relay-to-upstream hops?

the actual ingress or network relay?

Without them 4.1.1 can only be patched in place on top of the 4.1.0 image, which would leave the embedded version string reading 4.1.0.

date, or does 2.0.2 need the same curl patch as a fallback?