Skip to content

La Casa Del Dolor: run its S3 server on SeaweedFS instead of MinIO - #131564

Merged
PedroTadim merged 11 commits into
ClickHouse:masterfrom
groeneai:casa-del-dolor-seaweedfs
Nov 17, 2026
Merged

PedroTadim merged 11 commits into
ClickHouse:masterfrom
groeneai:casa-del-dolor-seaweedfs

Conversation

@groeneai

@groeneai groeneai commented Nov 14, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #131475

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

...

Description

La Casa Del Dolor still ran MinIO (migration asked in #131475 (comment)): dolor.py gets its S3 server from the integration harness (with_minio), which always starts docker_compose_minio.yml (minio1 and its proxies).

This PR adds ClickHouseCluster(s3_server="seaweedfs"): with_minio then starts the new docker_compose_seaweedfs.yml, one seaweedfs1 container (chrislusf/seaweedfs:4.48, as in setup_seaweedfs.sh) serving S3 on the MinIO port with the MinIO credentials, also reachable as minio1, the address of the Iceberg REST and Hive catalog services. dolor.py always uses it, Spark and the REST/Glue/Hive catalogs included; the default stays "minio", and TLS still needs MinIO. La Casa settings that still named the per-catalog minio:9000 container removed by #102861 (catalogs/datalakes.py, the BuzzHouse minio entry) now name the harness S3 server.

SeaweedFS runs with a 1 s raft election timeout: it serves again 3-7 s after a restart (13-22 s with the default 10 s), so an S3 restart needs no wait, like other integrations. A graceful stop takes about 17 s (its filer waits 15 s for open gRPC streams), hence stop_grace_period: 30s. The #131475 comment now names SeaweedFS, which rejects parts below 5 MiB with the same EntityTooSmall. La Casa draws the S3 disk's list_object_keys_size and objects_chunk_size_to_delete within its limits (65535 and 1000 keys). SeaweedFS ignores the anonymous s3:PutObject grant of prepare_s3_bucket; La Casa sends no unsigned request.

Validation (local, CI amd_debug binary of 6e60694): a harness smoke gives identical results on SeaweedFS and on MinIO (S3 function and disk, multipart uploads, EntityTooSmall below 5 MiB, data kept over a kill and a graceful stop). La Casa runs exit 0 on seaweedfs1 alone. A server stopped right after an S3 restart, with query_log on an S3 disk, stops in 4-6 s (19-25 s with the default timeout). The REST, Glue and Hive catalogs create, write and read Iceberg tables on SeaweedFS; Spark itself was not run.

🤖 Generated with Claude Code


Workflow [PR]
Sync PR [sync-upstream/pr/131564]

Version info

  • Merged into: 26.11.1.2564-master (included in 26.11 and later)

groeneai and others added 4 commits November 14, 2026 04:39
La Casa got its S3 server from the integration harness, which had exactly
one implementation behind `with_minio`: `setup_minio_cmd` always started
`docker_compose_minio.yml`, `minio_host` was the literal "minio1",
`wait_minio_to_start` always looked up the MinIO redirect proxy, and the
instance compose depended on "minio1". So `dolor.py` always ran MinIO,
while stateless CI moved to SeaweedFS in ClickHouse#113828.

`ClickHouseCluster` now takes `s3_server` ("minio" by default, or
"seaweedfs"). With "seaweedfs", `with_minio` starts the new
`docker_compose_seaweedfs.yml`: one `seaweedfs1` container running
`chrislusf/seaweedfs:4.48` with the flags of
`ci/jobs/scripts/functional_tests/setup_seaweedfs.sh`, serving S3 on the
MinIO port with the MinIO credentials. Every `minio_*` attribute, the
bucket setup, `minio_client` and the `base_minio_cmd` restart hook keep
working, so the disks, `dqtmp` and the `s3` named collection La Casa
generates point at `seaweedfs1` without changes to `properties.py`.
`wait_minio_to_start` also waits for one successful write, because a cold
SeaweedFS rejects writes until it has allocated its first volume, and
skips the proxy lookup there.

`-volume.preStopSeconds=1` drops the 10 s wait a volume server makes
before stopping, which only matters in a multi-node SeaweedFS cluster.
The filer still waits up to 15 s for its open gRPC streams on SIGTERM
(`weed/command/filer.go`, not configurable for `weed server`), so a
graceful stop takes about 17 s: `stop_grace_period` is 30 s, so the
"manual shutdown" of La Casa's S3 integration is not a SIGKILL.

`dolor.py` passes "seaweedfs" unless Spark or an Iceberg REST, Glue or
Hive catalog is requested: those shared services are set up against
`minio1`, and the CI job enables none of them.

The comment from ClickHouse#131475 now says SeaweedFS: it rejects
`CompleteMultipartUpload` of parts below 5 MiB with `EntityTooSmall`,
the same as MinIO (measured). The FIXME in `sparkserver.py` pointed at a
script that no longer exists; it now names `setup_seaweedfs.sh`, whose
endpoint, bucket and credentials the values below it are.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
An S3 restart in `dolor.py` used to end as soon as `docker compose start`
returned. MinIO served again under a second later; SeaweedFS serves an
object written before the stop only 14-22 s later (master raft election,
then filer and S3 start). When the run's time limit falls in that window,
the final teardown stops every server while their S3 disks and S3
`database_disk` point at a server that does not serve yet, and their
retried shutdown flushes are the `Server shutdown` failure that ClickHouse#131475
fixed. With the job's flags seed 2 hits it: the teardown began 0.09 s
after the start of `seaweedfs1`.

Before stopping or killing the S3 server, `dolor.py` now writes
`dolor/restart_probe`; after starting it, it waits (at most 60 s) until
the server reads that object and accepts a write. Measured: 14.0-18.1 s
on SeaweedFS.

The harness also rejects `s3_server="seaweedfs"` together with an
Iceberg REST, Glue or Hive catalog (their compose files and configs
hard-code `minio1`) or with `minio_certs_dir` (the SeaweedFS compose
serves plain HTTP), instead of starting a cluster that fails later.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
After an S3 restart `wait_s3_server_serving()` only logged a WARNING when the
server still did not serve 60 s after its start, and the run went on. The job
reads ERROR records only, so the S3 outage never reached its report; the
servers stopped later with their S3 disks unreachable were force-killed by the
teardown and the run was reported as `Server shutdown`.

Now the wait gives the server 120 s (the slowest measured recovery is 22 s),
logs an ERROR when it does not serve within that time and ends the run like a
failed ClickHouse restart. The job matches that message before the forced-stop
one and reports the run as `S3 server restart`. The probe object is written
once at startup, right after the bucket is prepared, instead of a best-effort
write before each stop, so a failed write before a restart can no longer leave
the wait without an object to read.

Also wrap three new over-long lines black-style.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The wait after an S3 server restart used the harness S3 client, whose
urllib3 pool sets no timeout, so a request falls back to the socket
default timeout, which nothing sets (None). A server that accepts the
connection and never answers therefore held the wait inside one request,
and the 120 s cap, checked only between requests, could not end it: the
run went on until the job watchdog.

The wait and the startup probe write now use their own client with a 5 s
connect and 10 s read timeout and no urllib3 retries, so every iteration
ends within about 30 s and a server that never answers ends the run at
most about 150 s after its start. The harness client shared by every
integration test, and the S3 uploader built on it, are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@groeneai

Copy link
Copy Markdown
Collaborator Author
Internal second-model review (rounds 1-4): 3 majors fixed, 1 minor fixed, 1 verification ask answered; round 4 clean
  • ❌ S3 restart ended before SeaweedFS served again (~20 s after a start), so a run ending in that window stopped its servers with S3 down: AGREE, dolor.py now waits for a read of a pre-stop object and a write after each S3 start.
  • ❌ That wait only warned after its cap, so a server that never came back was reported as Server shutdown: AGREE, after 120 s it now fails the run as S3 server restart.
  • ❌ The wait's S3 client had no socket timeout, so a server that accepts and never answers could hold the run past the cap: AGREE, the wait uses its own client with 5 s connect and 10 s read timeouts (the shared harness client is unchanged).
  • ⚠️ s3_server="seaweedfs" accepted with the catalogs or TLS: AGREE, the harness now rejects both.
  • ⚠️ Deterministic SeaweedFS proof requested: DISAGREE, a captured harness run covers it (only seaweedfs1 4.48, S3 function and disk with multipart, unsigned read, EntityTooSmall, data kept over kill and graceful stop, exit 0); a harness self-test is not wanted (Preserve the previous cluster incarnation's docker.log when an integration fixture restarts #119766).

@groeneai

Copy link
Copy Markdown
Collaborator Author

cc @PedroTadim, could you review this? La Casa Del Dolor now runs its S3 server on SeaweedFS (opt-in s3_server="seaweedfs" in the integration harness, default stays MinIO), and an S3 restart in dolor.py waits until SeaweedFS serves again, failing the run as S3 server restart after 120 s.

@groeneai

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes: on the base, a La Casa run starts minio1 (clickhouse/minio-minio) plus proxy1/proxy2/resolver, config at minio1:9001; with this PR the same command runs only seaweedfs1.
b Root cause explained? The harness had one hard-wired S3 server behind with_minio, and dolor.py takes its S3 server from the harness.
c Fix matches root cause? Yes: an explicit s3_server choice where the container is picked; every minio_* consumer is unchanged. La Casa opts in, the default stays MinIO.
d Test intent preserved / new tests added? Test-infrastructure change, so no harness self-test (#119766). Validated locally: harness smoke on both servers, La Casa runs, two MinIO integration tests.
e Both directions demonstrated? Yes: harness smoke 14/14 on SeaweedFS and on MinIO; La Casa seed 2 (time limit right after an S3 restart): teardown 0.09 s after start without the wait, 0.35 s after SeaweedFS served again with it; wait cut to 5 s: rc 1, reported as S3 server restart; a listener that never answers: the wait's client times out after 10 s, the harness client is still blocked at 60 s.
f Fix is general across code paths? Yes: disks, dqtmp, the s3 named collection, BuzzHouse, prepare_s3_bucket, S3Uploader, kill/stop/start, depends_on checked; Spark and the Iceberg REST/Glue/Hive catalogs keep MinIO, and the harness rejects s3_server="seaweedfs" with a catalog or TLS.
g Fix generalizes across inputs (params/datatypes/wrappers)? Kill and graceful stop, single-part and multipart uploads, parts below and at 5 MiB, authenticated and anonymous reads; amd64 and arm64 images.
h Backward compatible? (maintainer-approved exception only) Yes: s3_server defaults to "minio", so every other integration test runs the old code.
i Invariants and contracts preserved? base_minio_cmd names the compose file defining minio_host, so restarts address the right container; the graceful stop fits stop_grace_period; an S3 restart returns only once the server reads a pre-stop object and accepts a write; no serve within 120 s ends the run as S3 server restart, at most about 15 s past the cap (5 s connect, 10 s read timeouts).

Session id: cron:clickhouse-impl-slot-7:20261114-072100

@clickhouse-gh

clickhouse-gh Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [bfb069d]

Summary: ✅


AI Review

Summary

La Casa Del Dolor now uses SeaweedFS through an optional S3 backend in the integration harness, with updated catalog endpoints, restart targets, and request-size bounds. The earlier readiness-probe findings are addressed in the current code. No remaining actionable findings at bfb069d195075953b35380a8400fb984a3ff7567.

Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added pr-ci can be tested Allows running workflows for external contributors manual approve Manual approve required to run CI comp-testing Test content only (no production code). labels Nov 14, 2026
@PedroTadim PedroTadim self-assigned this Nov 15, 2026
Comment thread tests/casa_del_dolor/dolor.py Resolved
The S3 server is no longer always MinIO, so the flag that disables it is
now --without-s3-server. --without-minio stays as an alias, and both still
set `with_minio`, the name of the integration harness parameter.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Comment thread tests/integration/helpers/cluster.py Resolved
`wait_minio_to_start` probed SeaweedFS write readiness inside its retry loop,
after the three buckets were created. A failed probe (the expected cold-start
case: SeaweedFS fails writes until its first volume is allocated) made the next
pass take the existing-bucket branch, which calls `list_objects_v2`; the pinned
SDK (`minio==7.2.20`) has no such method, so every later pass raised
`AttributeError` and startup timed out even after the server became writable.

The probe now retries in `wait_seaweedfs_writable`, bounded by the same
deadline, so the bucket loop runs once. Checked locally with one injected probe
failure: before, 1 write attempt, then 175 `AttributeError` passes and
`Can't wait Minio to start` after 201 s; after, startup succeeds on the second
attempt in 17.7 s. With every probe failing, startup still ends at the 180 s
deadline.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Comment thread tests/casa_del_dolor/dolor.py Resolved
Comment thread tests/casa_del_dolor/dolor.py Resolved
@PedroTadim

Copy link
Copy Markdown
Member

🕵️ Review — La Casa Del Dolor on SeaweedFS

Nice switch; the plumbing checks out (SeaweedFS and ClickHouse share the compose default network so service-name resolution works, the digest include_paths already covers tests/integration/compose/, credentials match the SeaweedFS s3.json, minio_redirect_ip is read only by MinIO-only tests, and the ${MINIO_PORT:-9001} default is correct). All findings are in the harness, none in product code. Ranked:

1. wait_seaweedfs_writable can hang startup forever (helpers/cluster.py). The deadline is only checked inside the except branch, but the minio_client's PoolManager has no socket timeout — so a stalled put_object/remove_object never returns and never re-checks the deadline. If the S3 gateway accepts the TCP connection but stalls the HTTP request, dolor startup hangs until the job watchdog SIGKILLs it. dolor.py's restart probe sets Timeout(connect=5, read=10) + retries=False for exactly this; the startup probe should too.

2. A Unity-only run lands on SeaweedFS (dolor.py, s3_server selection). The condition omits args.with_unity, so invoking with only --with-unity <dir> (no --with-spark/--with-rest/--with-glue/--with-hms) leaves s3_server = "seaweedfs", yet the always-created SparkHandler points spark.hadoop.fs.s3a.endpoint at cluster.minio_ip — contradicting the stated "all Spark catalog services on MinIO" design and risking Unity write failures.

3. A SIGKILL restart can spuriously fail the whole run as "S3 server restart" (dolor.py, wait_s3_server_serving). The kill path sends SIGKILL; if it lands before SeaweedFS flushed the needle/index for dolor/restart_probe, get_object returns NoSuchKey for the full 120s window and the run is marked good_exit=False even though the server came back and serves new writes.

4. The durability oracle doesn't check content (dolor.py, wait_s3_server_serving). response.read()'s result is discarded and never compared to what was written, so a truncated/empty body after a restart (lost needle, live metadata) still passes the "reads the object written before its restart" check — silent post-restart corruption would go undetected, defeating the point of the read-back.

5–7 (lower). prepare_s3_bucket now calls set_bucket_policy against SeaweedFS, whose PutBucketPolicy semantics differ from MinIO and may reject the call, aborting startup. The one-shot startup probe put_object(S3_RESTART_PROBE) has no retry/try-except (unlike the bounded restart path), so a single transient error kills startup. And the write/read probe loop is duplicated between cluster.py and dolor.py — the two copies have already drifted (one is timeout-bounded, the other isn't — that's exactly the gap in #1); a single shared bounded-probe helper would prevent the recurrence.

groeneai and others added 3 commits November 16, 2026 09:58
… wait

With the default 10 s raft election timeout, a restarted `weed server`
serves S3 again only after 13-22 s, so dolor.py waited for the S3 server
after each restart, unlike every other integration it restarts. With
`-master.electionTimeout=1s` it serves again 3.2-7.3 s after `docker start`
(harness, kill and graceful stop, S3 disk attached; 3.2-3.3 s for all five
restarts of a La Casa run), so the wait, its probe client and the
`S3 server restart` result class are removed. A graceful stop still ends
with exit code 0 in 17-19 s; Hashicorp raft and a 300 ms election timeout
serve again in 2.3 s but then hang on every graceful stop until the 30 s
grace SIGKILLs them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
dolor.py kept MinIO when Spark or an Iceberg REST, Glue or Hive catalog was
requested, because those shared services address the S3 server as
`minio1:9001`. The SeaweedFS service now has the network alias `minio1`, so
they reach SeaweedFS without changes to their compose files, the harness no
longer rejects a catalog with s3_server="seaweedfs", and dolor.py always uses
SeaweedFS.

Two La Casa settings still named the per-catalog MinIO container (`minio`,
port 9000) that ClickHouse#102861 removed, which resolves on neither server: the S3
endpoint of the Spark and pyiceberg catalogs in `catalogs/datalakes.py`
(`get_instance_ip('minio')` raised `docker.errors.NotFound`), and the
BuzzHouse `minio` entry that BuzzHouse uses for catalog storage endpoints,
Spark lake paths and the S3Queue `after_processing_move_uri`. Both now use
the harness S3 server (`minio_ip`/`minio_host`, `minio_port`).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`wait_seaweedfs_writable` checked its deadline only after a failed call,
but the harness client has no socket timeout, so a server that accepts the
connection and never answers held the startup forever. The probe now has
its own client with connect 5 s / read 10 s timeouts and no retries: against
such a listener it raises after 21 s with a 15 s deadline (the old client was
still blocked after 90 s).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Comment thread tests/integration/helpers/cluster.py Resolved
@groeneai

Copy link
Copy Markdown
Collaborator Author

Thanks for the review. Status on the current head:

  1. Fixed in 0fad72a: the write probe now has its own client (connect 5 s, read 10 s, no retries). Against a listener that accepts and never answers it raises after 21 s with a 15 s deadline; the old client was still blocked after 90 s.
  2. Moot after bec4ca6: Dolor always uses SeaweedFS now, Unity included.
    3, 4, 6, 7. Moot after 4732fb3: the restart wait, its probe client and the startup probe write are removed (SeaweedFS serves again 3-7 s after a restart), so the only probe left is the one in cluster.py.
  3. set_bucket_policy succeeds on SeaweedFS 4.48: every local run calls it, and the anonymous reads it grants work in the harness smoke.

@clickhouse-gh clickhouse-gh Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI review approves this commit, see the AI Review comment.

@PedroTadim

Copy link
Copy Markdown
Member

🕵️ @groeneai This PR's own La Casa Del Dolor (amd_debug) run fails because of SeaweedFS: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=131564&sha=0fad72a8c89b0ce9d97c4a0ebe776e9809ea6bc0&name_0=PR&name_1=La%20Casa%20Del%20Dolor%20%28amd_debug%29

After a kill-restart the server can't start again. server.err.log:
Could not list objects in bucket 'root' with prefix 'data0/__meta/__tombstone', S3 exception: InvalidArgument ... Argument maxKeys must be an integer between 0 and 2147483647

That message is wrong: SeaweedFS 4.48 accepts max-keys up to 65535 only (I probed ListObjectsV2 on chrislusf/seaweedfs:4.48: 65535 works, 65536, 10485760 and 2147483647 all get the error above). MinIO accepted these values. Dolor draws the disk setting list_object_keys_size from threshold_generator(0.2, 0.2, 1, 10 * 1024 * 1024, 31) (properties.py:736 and :813), so about 80% of its values break every listing on that disk.

Could you cap both at 65535 (for example threshold_generator(0.2, 0.2, 1, 65535, 16), with a 1-line comment on why), and check the other S3 request-size settings in the same block against SeaweedFS's limits? The local runs didn't draw this setting, so they wouldn't have caught others like it either.

…dFS limits

SeaweedFS 4.48 parses the ListObjectsV2 `max-keys` as a 16-bit integer and
answers `InvalidArgument` above 65535 (MinIO accepted any value). The S3
disk's `list_object_keys_size` was drawn up to 10 MiB and 2^31 - 1, about
80% of the values, so a `plain_rewritable` disk could not list its metadata
and the server did not start again after a kill (PR La Casa run on
0fad72a, exit 243). Draw it from 1 to 65535.

SeaweedFS also answers `InvalidArgument` to a DeleteObjects of more than 1000
keys (the S3 limit; MinIO answered `MalformedXML`). `objects_chunk_size_to_delete`
was drawn up to 10 MiB and 2^32 - 1, so draw it from 0 to 1000.

Validated with the master debug binary and SeaweedFS 4.48 (the PR's compose
command): a `plain_rewritable` S3 disk with `list_object_keys_size=10485760`
fails to start after kill -9 with the CI message, with 65535 / 1000 it starts
and reads its 2000 rows. The Azure disk's `list_object_keys_size` is left as
is: it is served by Azurite, which accepts `maxresults` up to 2^31 - 1.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@groeneai

Copy link
Copy Markdown
Collaborator Author

Done in 1ededdc:

  • list_object_keys_size (S3 disk): threshold_generator(0.2, 0.2, 1, 65535, 16). With the master debug binary on chrislusf/seaweedfs:4.48, a plain_rewritable disk with 10485760 fails to start after kill -9 with the CI message; with 65535 it starts and reads its rows.
  • objects_chunk_size_to_delete: now 0 to 1000. SeaweedFS answers InvalidArgument to a DeleteObjects of more than 1000 keys (MinIO answered MalformedXML), and deleteFilesFromS3 takes InvalidArgument as DeleteObjects being unsupported.

The rest of the block is within SeaweedFS's limits: s3_max_part_number can draw 16383 against its 10000 parts, but part 10001 needs a file above ~48 GiB since every part is at least 5 MiB; it caps no part, PUT or copy size; the 5 MiB minimum part is already kept; the other settings are client-side only.

Line 813 is the Azure disk, which runs on Azurite, not SeaweedFS. Azurite 3.35.0 lists with maxresults 65536, 10485760 and 2147483647, so I left it as is.

@clickhouse-gh clickhouse-gh Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI review approves this commit, see the AI Review comment.

@PedroTadim
PedroTadim enabled auto-merge November 17, 2026 10:24
@PedroTadim
PedroTadim added this pull request to the merge queue Nov 17, 2026
Merged via the queue into ClickHouse:master with commit 104a94d Nov 17, 2026
192 checks passed
@robot-clickhouse robot-clickhouse added the pr-synced-to-cloud The PR is synced to the cloud repo label Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors comp-testing Test content only (no production code). manual approve Manual approve required to run CI pr-ci pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants