Skip to content

Replace MinIO with (up to 4x faster) SeaweedFS in stateless CI - #113828

Merged
azat merged 6 commits into
ClickHouse:masterfrom
azat:ci-stateless-seaweedfs
Aug 11, 2026
Merged

azat merged 6 commits into
ClickHouse:masterfrom
azat:ci-stateless-seaweedfs

Conversation

@azat

@azat azat commented Aug 7, 2026 •

Copy link
Copy Markdown
Member

Note, that MinIO has some basic scalability (at least last available OSS version) issues so even disabling fsync (it does not allows to do this, but I did it with strace -qq -f -e inject=fsync,fdatasync:retval=0 -e exit_group -e signal=9 /usr/bin/minio server) and literally nothing changed, strace shows some futex calls (even though it is not 100% accurate since strace itself has overhead)

Benchmarks

So in some corner cases it can be up to 11x faster, but overall on a normal load it is 2-4x faster on EBS (likely due to lack of fsync), but this is what we need for CI, we do not care about durability there

The AIStor bundle and integration tests keep MinIO.

Provisioning (bucket creation, write-readiness probe, test data upload) is done with weed shell and the filer HTTP API, so no S3 client (mc/aws) is required and nothing writes ~/.aws (an existing [default] profile is no longer picked up).

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):

Replace MinIO with (up to 4x faster) SeaweedFS in stateless CI

Version info

  • Merged into: 26.8.1.1183 (included in 26.8 and later)

SeaweedFS is much faster than MinIO for our CI. It has no runtime user
administration, so identities (clickhouse, test, and the anonymous one
that makes the test bucket public) are declared in a static s3.json and
provisioning uses the aws cli instead of mc. The S3 endpoint answers
before volume allocation is ready on a cold start, so setup waits for a
canary write. The AIStor bundle and integration tests keep MinIO.
@clickhouse-gh

clickhouse-gh Bot commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [99529c5]

Summary: ✅


AI Review

Summary

This PR switches stateless CI from MinIO to SeaweedFS, updates the stateless harness and preload path, and keeps the two S3-compatibility cases that SeaweedFS cannot model by moving them into MinIO-backed integration tests. I did not find a remaining correctness issue in the current diff; the previously raised coverage regressions are addressed by test_url_encoding_on_wire and test_asterisk_glob_non_empty_trailing_slash_object.

Missing context / blind spots
  • ⚠️ The full SeaweedFS-backed PR matrix was still pending at review time, so I could not validate the harness end to end from completed CI results. A green stateless / PR run on commit 99529c539ea4fffd01698e2ad535138cfbe98cc0 would close that remaining execution gap.
Final Verdict

✅ No blocking issues found in the current diff.

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Aug 7, 2026
@azat

This comment was marked as outdated.

azat added 2 commits August 7, 2026 19:24
…coding

seaweedfs URL-decodes the raw request path before splitting it into
bucket/key, so it served the object and the enable_url_encoding=0
query returned data instead of the error the test greps; MinIO treats
the un-decoded path as a bucket name and fails. Use a nonexistent key
so any S3 server errors and the message carries the raw %2F path.
SeaweedFS stores a key ending with '/' as a filer directory and
silently drops content written into it, so the Parquet object the test
wrote under the folder key came back as 0 bytes. Write the marker as a
genuinely empty object (as the S3 console creates them) and skip empty
files in the reads.
@alexey-milovidov

Copy link
Copy Markdown
Member

This is good, why not to merge?

@azat
azat marked this pull request as ready for review August 8, 2026 07:06
@azat azat changed the title Replace MinIO with (20x faster) SeaweedFS in stateless CI [DRAFT] Replace MinIO with (20x faster) SeaweedFS in stateless CI Aug 8, 2026
@azat

azat commented Aug 8, 2026

Copy link
Copy Markdown
Member Author

I thought that we may want to use MinIO since it is more widely adopted (and setups may use MinIO for storing data).
I'm fine with replacing it (since it is really slow in some workloads) but probably we will still want to leave some job with real MinIO

Overall looks like this S3 implementation works (unlike rustfs - #113825), let's see what private CI will tell (forgot that now there no sync for drraft PRs)

@alexey-milovidov alexey-milovidov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, let's merge!

@alexey-milovidov alexey-milovidov self-assigned this Aug 10, 2026
@alexey-milovidov

Copy link
Copy Markdown
Member

I thought that we may want to use MinIO since it is more widely adopted (and setups may use MinIO for storing data).
I'm fine with replacing it (since it is really slow in some workloads) but probably we will still want to leave some job with real MinIO

We can randomize it, e.g., 9/10 goes to SeaweedFS, 1/10 goes to Minio.

@alexey-milovidov

alexey-milovidov commented Aug 10, 2026 •

Copy link
Copy Markdown
Member

since it is more widely adopted

This is no longer true. The original Minio is archived and abandoned. It may no longer represent the AIStor product that is used instead.

This repository https://github.com/minio/minio is abandonware.

@azat

azat commented Aug 10, 2026

Copy link
Copy Markdown
Member Author

This is no longer true

I assumed that it is still widely adopted just because not a lot of setups migrated, but it is true that the public repo is not maintained and they stopped publishing docker images even earlier - minio/minio#21647

We can randomize it, e.g., 9/10 goes to SeaweedFS, 1/10 goes to Minio.

I was thinking about "ping some release job to use MinIO", but obviously it will be nice to avoid it and replace it completely, I was just not sure about this (due to some possible compatibility issues - hence draft)

To be honest I would like to replace MinIO, eventually it make sense, it is not maintained for a long time already.

@azat

azat commented Aug 10, 2026

Copy link
Copy Markdown
Member Author

It may no longer represent the AIStor product that is used instead.

Indeed. Especially with this AI era. Maybe it is OK just to replace it completely...

@azat azat changed the title [DRAFT] Replace MinIO with (20x faster) SeaweedFS in stateless CI [DRAFT] Replace MinIO with (up to 4x faster) SeaweedFS in stateless CI Aug 10, 2026
@azat

azat commented Aug 10, 2026 •

Copy link
Copy Markdown
Member Author

I've re-benchmarked it (and during this I remembered that my MinIO disk is on HDD):

So in some corner cases it can be up to 11x faster, but overall on a normal load it is 2-4x faster on EBS (likely due to lack of fsync), but this is what we need for CI, we do not care about durability there

@azat azat changed the title [DRAFT] Replace MinIO with (up to 4x faster) SeaweedFS in stateless CI Replace MinIO with (up to 4x faster) SeaweedFS in stateless CI Aug 10, 2026
Bucket via weed shell, probe/upload via the unauthenticated filer HTTP
API; the CI harness reachability check gets credentials via env.
curl --aws-sigv4 is broken in curl 7.81 (ubuntu 22.04 images).

Refs: ClickHouse#113828 (comment)
Refs: ClickHouse#113828 (comment)

Co-Authored-By: Claude Fable 5 <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

No arm_release build profile data for commit 99529c5 - the build was skipped, reused from cache, or predates profile upload.

The S3 server setup no longer writes ~/.aws/credentials, so the
credential-less head-object failed.

Co-Authored-By: Claude Fable 5 <[email protected]>
…integration tests

Stateless CI now runs SeaweedFS, which URL-decodes the raw request path
before routing and cannot store a non-empty object whose key ends with
`/`. Two stateless tests therefore lost coverage:

- `02833_url_without_path_encoding` can no longer prove that
  `enable_url_encoding = 0` preserves the raw path on the wire.
- `03271_s3_table_function_asterisk_glob` can no longer read a
  non-empty trailing-slash object via `*` globs.

Restore both on MinIO (kept by integration tests):

- `test_url_encoding_on_wire` asserts the server-observed path via the
  `echo.py` mock for both values of `enable_url_encoding`.
- `test_asterisk_glob_non_empty_trailing_slash_object` reads a
  non-empty `.../` key through `s3` and `s3Cluster` globs with
  `s3_skip_empty_files = 0`.

Co-Authored-By: Claude Fable 5 <[email protected]>
@azat
azat enabled auto-merge August 11, 2026 14:45
@chrislusf

Copy link
Copy Markdown
Contributor

Nice to discover this! Thanks for benchmarking also!

Regarding the CI, I would recommend using "weed mini" instead of "weed server". "weed mini" would also start the Iceberg REST catalog. It can be used together with S3 Table Bucket feature. I think ClickHouse should have local integration tests using S3 Table Buckets.

@azat

azat commented Aug 11, 2026

Copy link
Copy Markdown
Member Author

"weed mini" would also start the Iceberg REST catalog. It can be used together with S3 Table Bucket feature. I think ClickHouse should have local integration tests using S3 Table Buckets.

Yep, for stateless tests and at least now we don't have tests that requires REST catalog, but probably will, then we will use it (which can be very useful)

Thanks for taking a look

@azat
azat added this pull request to the merge queue Aug 11, 2026
Merged via the queue into ClickHouse:master with commit 7429db7 Aug 11, 2026
355 of 356 checks passed
@azat
azat deleted the ci-stateless-seaweedfs branch August 11, 2026 21:23
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-synced-to-cloud The PR is synced to the cloud repo label Aug 11, 2026
FriendLey pushed a commit to FriendLey/ClickHouse that referenced this pull request Aug 18, 2026
Since 2026-08-12, s3 storage stateless jobs intermittently fail an ordinary
INSERT with "Code: 499 ... Immediately after upload: Object ... suddenly
disappeared (S3_ERROR)". The object really was destroyed. SeaweedFS's
asynchronous empty-folder cleaner counts a folder's entries
(empty_folder_cleaner.go:297) and then deletes the folder (:329) without
excluding a PUT arriving in between, so a write landing in that window is lost.
From a failing master run's own artifacts:

  16:18:17.675651  EmptyFolderCleaner: deleting empty folder /buckets/test/test/jys
  16:18:17.676290  PUT of the object SUCCEEDS, 282 bytes
  16:18:17.678805  verifying HEAD -> 404
  16:18:17.681060  WriteBufferFromS3: Nothing to abort (ClickHouse did not remove it)

This became reachable when ClickHouse#113828 replaced MinIO with SeaweedFS in stateless
CI. ClickHouse keys objects as <prefix>/<3 chars>/<random>, so the bucket holds
thousands of shallow folders that empty and refill continuously, which is the
churn that arms the race: in one job 34,819 of 45,578 cleaner log lines were
deletions, peaking at 3,238 per minute, and one folder was deleted 4 times.
CIDB shows 0 hits in the preceding 180 days and hits on 2026-08-12 only, with
301 rows mentioning WriteBufferFromS3 and 2.7e8 rows carrying a non-empty
context over 30 days as positive controls that the zero is real.

Setting the cleanup delay past a job's lifetime keeps every folder out of reach
of that deletion. The cleaner still runs and still queues work; only its
eligibility window moves, and the empty folders persist in an instance that is
destroyed at job end.

The per-bucket opt-out Seaweed-X-Amz-Allow-Empty-Folders was tried first and
cannot be written with the tooling this script has: no weed shell subcommand
sets a bucket extended attribute, and a filer PUT carrying the header on the
bucket directory returns 201 while Extended stays null. The same header on a
file does land, which confirms the negative rather than a broken probe: the
filer copies Seaweed- prefixed headers into Extended only on the file-create
path (filer_server_handlers_write_autochunk.go:331-335). The deprecated
-s3.allowEmptyFolder flag is ignored in 4.41 and would silently no-op.

No src/ change. s3_check_objects_after_upload behaved correctly and caught a
genuinely destroyed write; retrying or relaxing it would have hidden a real
lost object. The race itself is upstream's to fix.

Validated against the shipped script with the arms differing only by these
lines: without the change the cleaner deletes 13 folders and 0 of 12 survive,
with it there are 0 deletions and 12 of 12 survive, while the queue still holds
its 12 items past 3m03s where the baseline drained at 2m03s.

Related: ClickHouse#113828
qiuyanjun888 pushed a commit to qiuyanjun888/ClickHouse that referenced this pull request Sep 26, 2026
setup_seaweedfs.sh launches the all-in-one daemon with "nohup weed server ... &"
and never captures $!, so neither of its two readiness loops can tell a dead
server from a slow one. weed exits on any startup error, and every such error is
a glog.Fatalf that terminates the whole process, so the loops poll a corpse for
their entire 60s budget and the script then reports "failed to setup seaweedfs",
a message that names no cause. functional_tests.py prints "SETUP FAILURE:
seaweedfs/azurite did not start" and the stateless job produces zero named test
rows, so the class is invisible to every test-name query and only surfaces in a
job-level sweep. setup_kafka.sh already does this correctly (:53 REDPANDA_PID=$!,
:62-66 kill -0 plus "fail fast instead of polling for 60s"); this file never
adopted the pattern.

The lane is still lost when weed dies, and that is deliberate rather than a
shortfall of this change. functional_tests.py:1531 passes all=test_run_failed to
prepare_logs, and clickhouse_proc.py:842-849 appends seaweedfs.log to the
artifact list only under "if all:". A retry that succeeded would leave
test_run_failed False, so the Go fatal stack would never be published, and that
artifact is the only place the cause exists: it never reaches CIDB
test_context_raw. A relaunch would therefore convert a visible, evidence-bearing
failure into a silent pass. This change buys attribution and speed, not coverage
recovery.

What exposed it is an upstream data race, which is not worked around here.
ViperProxy (weed/util/config.go) embeds *viper.Viper and a mutex and wraps five
accessors, but GetStringMap is not among them, so it is silently promoted from
the embedded value and takes no lock. weed/storage/backend/backend.go takes the
concrete *util.ViperProxy rather than the five-method interface and calls
GetStringMap("storage.backend") from startMaster, reading the same v.defaults map
that NewVolumeServer writes via SetDefault; weed/command/server.go forks the two
with no barrier between them. Go's map-race detector then aborts the process with
"fatal error: concurrent map read and map write". A version bump does not help:
weed/util/config.go is byte-identical on 4.42, 4.45 and master, and spf13/viper
is pinned at v1.21.0 across all of them, with no internal locking. Steering weed
around its own race with WEED_STORAGE_BACKEND was rejected: it depends on the
undocumented internal precedence order of a third-party library, it makes
storage.backend unconfigurable through a variable whose name says the opposite,
and it would leave the harness blind to every other cause of death anyway.

The harness gap is reachable by a whole class of causes, not only by that race,
so validation used two deterministic injections at two different fatal sites,
with the real weed 4.42 binary and the real script. A non-writable meta folder
gives "server.go:353 Check Meta Folder (-mdir=...) Writable: Not writable!" and
an occupied master port gives "master.go:206 Master startup error: listen tcp
127.0.0.1:11112: bind: address already in use". Each goes from 60.9s with no
cause to 1.3s naming the dead pid. Killing the server once the bucket create has
succeeded exercises the second loop, which the first injection never reaches:
5.1s instead of 60s.

Because kill -0 succeeds on an unreaped zombie, a liveness check can be present
and inert, so each check was mutation-tested. Deleting only the block in
wait_for_it restores the 60.9s grind and loses the pid line; deleting only the
block in setup_seaweedfs regresses to 79.9s with that loop spinning all 60
iterations. Neither check is vacuous. The converse also holds: with 200ms of
loopback latency the server is alive but slow, the check does not fire and the
script still exits 0, so a slow start is not misreported as a death. Five
repeats of the healthy path stay green at 4.1 to 6.2s with the upload intact.

start_azurite (ci/jobs/scripts/clickhouse_proc.py:211-224) has the same defect:
Shell.check(..., retries=6) backs off 2+4+8+16+32 = 62s without consulting
azurite_proc, so a dead azurite is also polled to the end of its budget. No
azurite startup death has been observed, so it is left alone here rather than
widening a one-file change to a second daemon on speculation.

Related: ClickHouse#113828
omar12eladawy pushed a commit to omar12eladawy/ClickHouse that referenced this pull request Nov 17, 2026
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

4 participants