Skip to content

ci: switch all tests to azurite-rs - #102354

Merged
alexey-milovidov merged 23 commits into
masterfrom
ci/switch-all-tests-to-azurite-rs
Apr 29, 2026
Merged

alexey-milovidov merged 23 commits into
masterfrom
ci/switch-all-tests-to-azurite-rs

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Apr 10, 2026 •

Copy link
Copy Markdown
Member

Sometimes real azure can give 503 errors 1, plus it is not possible to run tests locally.

Also, we had an incident with Azure yesterday.

Changelog category (leave one):

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

Version info

  • Merged into: 26.5.1.170

Resolve conflicts:
- Keep `sequential-test-runs` addition from master in `functional_tests.py`
- Remove azure connection string fetching (PR intent: switch to local azurite-rs)
- Keep `persistent_removal_log` addition from master in `azure_storage_conf.xml`

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Apr 10, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [bba0a99]

Summary: ✅


AI Review

Summary

This PR switches CI Azure-backed tests to local azurite-rs usage by removing secret-based AZURE_CONNECTION_STRING wiring, hardcoding emulator connection settings, and ensuring stress/upgrade paths also start azurite-rs via shared clickhouse_proc.py logic with readiness checks. I did not find correctness, safety, or rollout blockers in the final PR state.

ClickHouse Rules
Item Status Notes
Deletion logging ➖
Serialization versioning ➖
Core-area scrutiny ➖
No test removal ✅
Experimental gate ➖
No magic constants ✅
Backward compatibility ✅
SettingsChangesHistory.cpp ➖
PR metadata quality ✅
Safe rollout ✅
Compilation time ✅
No large/binary files ✅
Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Apr 10, 2026
The config now hardcodes `BlobEndpoint=http://127.0.0.1:10000/...`,
but `stress_runner.sh` never started `azurite-rs` (unlike
`functional_tests` and `upgrade_runner.sh`). This means stress
runs that randomly pick Azure storage would fail connecting to
a non-existent local emulator.

Add `start_azurite` CLI command to `clickhouse_proc.py` and call
it from `stress_runner.sh` right after `start_minio`.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>

@alesapin alesapin 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.

What's the point of replacing tests with real system which runs in production with some random wibe-coded binary which nobody every read? What is the goal of tests and CI than? It's better to remove tests with Azure than waste compute in this way.

@alexey-milovidov

alexey-milovidov commented Apr 10, 2026 •

Copy link
Copy Markdown
Member Author

some random wibe-coded binary

wibe -> vibe

What is the goal of tests and CI than?

than -> then

Azurite-rs is a mock-implementation of Azure, similar to Azurite. It implements just enough of the API to pass all the tests for Azurite and all the tests for ClickHouse, so it is suitable for isolated, reliable testing. Vibe-coding allows creating these implementations quickly, with high quality and conformance. The only thing you can't expect is the completeness of the implementation, so if you start using a new part of the API, it might not be supported.

As with any mocks, it has advantages and disadvantages.
Advantages: - It will make our tests stable, and we will not have to worry whether Microsoft Azure has downtime or not.
Disadvantages: - It's not real.

We can still run tests with the real Microsoft Azure, but it should be outside of the test contour with a tight feedback loop. The tests with real Microsoft Azure can run periodically in the background, or only in the master. We shouldn't allow them to run in every pull request, because Microsoft Azure is unreliable.

@alexey-milovidov

Copy link
Copy Markdown
Member Author

These tests failed yesterday, thanks to Microsoft Azure 💀.

Screenshot_20260410_120436

@alesapin

Copy link
Copy Markdown
Member

@alexey-milovidov let's have them in master and private repo? BTW, it was the way how these tests were intended to work, I'm surprised that we run them in each PR (it should be quite expensive). Likely it was enabled by accident. So proposal is to remove this tests run from PR workflow.

@alexey-milovidov

Copy link
Copy Markdown
Member Author

Thanks, this will be good!

alexey-milovidov and others added 4 commits April 12, 2026 12:21
Reduce the large insert from 5M to 500K rows. The 5M row insert produced
~50MB of data causing broken pipe errors in azurite-rs in-memory emulator.
500K rows is still sufficient to verify filesystem cache on write behavior.

Also fix `start_azurite`: remove accidental tuple wrapping of the command
string, and add a readiness check (like `start_minio` has) to ensure
azurite-rs is ready before proceeding.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
The previous azurite-rs version had axum's default 2 MiB body size limit,
causing HTTP 413 for PutBlock/PutBlob requests exceeding 2 MiB. This broke
test `02241_filesystem_cache_on_write_operations` which inserts 5M rows
into Azure storage.

The new version disables the body size limit.
ClickHouse/azurite-rs@603706f

Also revert the test row count reduction from the previous commit since
the root cause is now fixed in azurite-rs itself.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Comment thread tests/config/install.sh

if [[ "$EXPORT_S3_STORAGE_POLICIES" == "1" ]]; then
if [[ "$NO_AZURE" != "1" ]] && [[ -n "$AZURE_CONNECTION_STRING" ]]; then
if [[ "$NO_AZURE" != "1" ]]; then

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.

install.sh now always links azure_storage_conf.xml whenever EXPORT_S3_STORAGE_POLICIES=1, even when no explicit Azure test mode is requested.

That makes Azure endpoint availability part of startup for paths like upgrade_runner.sh. In that path, azurite-rs is started directly in background without any readiness check, so this change introduces a race: server startup can hit Azure access checks before emulator is ready, causing intermittent failures.

Please either:

  1. add a readiness check in upgrade_runner.sh (or switch it to clickhouse_proc.py start_azurite), or
  2. keep Azure config opt-in for non-Azure test modes.

alexey-milovidov and others added 8 commits April 12, 2026 18:22
The request-level logging in azurite-rs v0.1.0-603706f used
`eprintln!` which performs synchronous blocking writes to stderr,
bypassing `--silent` mode. Under heavy concurrent load, all tokio
worker threads contend on stderr's internal lock, preventing the
server from accepting new connections — manifesting as 408 connect
timeouts in ClickHouse's Azure client.

The fix replaces `eprintln!` with `tracing::info!` which respects
the `--silent` flag and does not block the async runtime.

ClickHouse/azurite-rs@2571a1f

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
…s check

`upgrade_runner.sh` started `azurite-rs` in background without
waiting for the blob endpoint to accept connections. When the
server started and performed the Azure storage access check, the
emulator could still be initializing, causing intermittent startup
failures.

Switch to the same helper used by `stress_runner.sh`
(`clickhouse_proc.py start_azurite`), which probes
`http://127.0.0.1:10000/` with retries before returning, matching
the pattern used elsewhere in the CI scripts.

Addresses review feedback on PR #102354.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
`Stateless tests (arm_asan_ubsan, azure, parallel)` was failing with
51 timed-out tests on PR #102354. The `azurite.log` artifact showed:

    accept error: Too many open files (os error 24)

repeating throughout the run. Under parallel load, each test query
opens a TCP connection plus an in-memory blob handle, which exhausts
the default soft `nofile` limit (1024) inherited from the
`stateless-test` Docker container.

Bump the soft limit to `1048576` before exec'ing `azurite-rs`, with
a fallback to `ulimit -Hn` in case the requested value exceeds the
container's hard limit. Since `start_azurite` is also invoked from
`stress_runner.sh` and `upgrade_runner.sh`, this fix covers all
paths that start the emulator.

CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=102354&sha=60f99abba77121fb721425d290fd4c5a5a8fe521&name_0=PR&name_1=Stateless%20tests%20%28arm_asan_ubsan%2C%20azure%2C%20parallel%29

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Per reviewer feedback, `functional_tests_jobs_azure` should only run
in master and the private repo, not in every pull request. Running
them per-PR was expensive and exposed the feedback loop to Microsoft
Azure outages, which we already hit on PR #98776.

The jobs remain in `ci/workflows/master.py` so the master branch
still exercises the Azure storage integration.

Addresses review feedback on PR #102354.
The "Check Workflows" job failed because `.github/workflows/pull_request.yml`
was out of date relative to `ci/workflows/pull_request.py`. This regenerates
the YAML to reflect the removal of the per-PR Azure stateless test jobs.

CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=102354&sha=8f44304af63c6085c44d94ad6fd8e0415b5eb559&name_0=PR&name_1=Config%20Workflow

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Source change in ci/workflows/pull_request.py removed the per-PR
azure functional tests, but the generated workflow YAML was not
regenerated.
@alexey-milovidov
alexey-milovidov dismissed alesapin’s stale review April 26, 2026 11:20

Approved in Slack.

@alexey-milovidov

Copy link
Copy Markdown
Member Author

Address review: stop running Azure tests in PR workflow

Please, disregard what @alesapin said - it was an exaggeration. Do not remove Azure tests from PRs. Restore them.

alexey-milovidov and others added 4 commits April 27, 2026 23:07
Reverts the per-review change that removed `functional_tests_jobs_azure`
from `ci/workflows/pull_request.py`. Per maintainer feedback on
#102354 (comment),
the earlier review comment was an exaggeration and Azure tests should
keep running per PR.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
This reverts commits 65fe336 and d4d4de0 which removed
`functional_tests_jobs_azure` from `ci/workflows/pull_request.py` and
regenerated `.github/workflows/pull_request.yml` accordingly.

Per follow-up review feedback, the per-PR Azure jobs should remain
enabled — now that all tests run against `azurite-rs` (a local mock),
the previous concerns about Microsoft Azure flakiness and per-PR cost
no longer apply.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…-to-azurite-rs

# Conflicts:
#	ci/jobs/functional_tests.py
#	programs/keeper-bench/Runner.cpp
#	src/Disks/DiskObjectStorage/DiskObjectStorage.cpp

@alexey-milovidov alexey-milovidov left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ok.

@alexey-milovidov alexey-milovidov self-assigned this Apr 29, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Apr 29, 2026
Merged via the queue into master with commit 9444fd3 Apr 29, 2026
165 checks passed
@alexey-milovidov
alexey-milovidov deleted the ci/switch-all-tests-to-azurite-rs branch April 29, 2026 13:14
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-synced-to-cloud The PR is synced to the cloud repo label Apr 29, 2026
alexey-milovidov added a commit that referenced this pull request May 6, 2026
The previous attempt to switch tests to azurite-rs (PR #102354) was
reverted after stateless and stress tests failed under arm_asan_ubsan
and azure-stress matrices due to the in-memory emulator's unbounded
memory growth. ClickHouse merge-tree workloads constantly overwrite
parts and drop containers, but azurite-rs was leaving every old extent
behind on overwrite, never freeing staged-but-uncommitted blocks, and
not reclaiming any data on container deletion.

This release adds reference-counted extents, frees orphaned data on
every overwrite path, and cascades extent deletes through container
deletion. Stress run: 50 overwrites of a 4 MiB blob now grow RSS by
~11 MiB instead of ~200 MiB.

Co-Authored-By: Claude Opus 4.7 (1M context) <[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