Skip to content

Fix flaky test 02859_replicated_db_name_zookeeper - #101952

Merged
alexey-milovidov merged 1 commit into
masterfrom
fix-02859-replicated-db-name-zookeeper
Apr 8, 2026
Merged

alexey-milovidov merged 1 commit into
masterfrom
fix-02859-replicated-db-name-zookeeper

Conversation

@alexey-milovidov

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

Copy link
Copy Markdown
Member

The test scans all entries under /clickhouse/databases/ in ZooKeeper and calls toUUID on each path suffix. When other parallel tests create entries with non-UUID names (e.g. d2_test_8e50qzr4), the parse fails with CANNOT_PARSE_UUID.

Fix: use toUUIDOrNull instead and filter out NULL results.

Failure: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=101892&sha=633508e66d8356bbaa20a2af613a540aecbe96e9&name_0=PR&name_1=Stateless%20tests%20%28arm_binary%2C%20parallel%29
#101892

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

...

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

Version info

  • Merged into: 26.4.1.632

The test scans all entries under `/clickhouse/databases/` in ZooKeeper
and calls `toUUID` on each path suffix. When other parallel tests create
entries with non-UUID names, the parse fails with CANNOT_PARSE_UUID.

Use `toUUIDOrNull` instead and filter out NULL results.

https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=101892&sha=633508e66d8356bbaa20a2af613a540aecbe96e9&name_0=PR&name_1=Stateless%20tests%20%28arm_binary%2C%20parallel%29

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

clickhouse-gh Bot commented Apr 7, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [daa8240]

Summary: ✅


AI Review

Summary

This PR fixes a flaky stateless test by replacing toUUID with toUUIDOrNull when parsing ZooKeeper node suffixes and filtering out NULL UUIDs before joining system.databases. The change is minimal, targeted, and correctly addresses the reported parallel-test failure mode without altering product behavior.

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 ✅
Final Verdict
  • Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Apr 7, 2026
@alexey-milovidov

Copy link
Copy Markdown
Member Author

Root cause analysis

The test scans all children of /clickhouse/databases/ in ZooKeeper and calls toUUID on each path suffix, assuming they are all UUIDs. This assumption is wrong — several other tests create Replicated databases with literal (non-UUID) ZooKeeper paths under that prefix.

The specific entry d2_test_8e50qzr4 that caused the failure comes from 03784_bad_base_backup.sh (line 32):

CREATE DATABASE d2_$CLICKHOUSE_DATABASE ENGINE = Replicated('/clickhouse/databases/d2_$CLICKHOUSE_DATABASE', 's0', 'd0');

Three other tests also create non-UUID entries directly under /clickhouse/databases/ via the {database} macro (which expands to the literal database name):

  • 03362_create_table_after_truncate_replicated_database.sql
  • 03655_keeper_map_alter_comment.sql
  • 03321_create_table_as_replicated_engine_args.sql

These are all legitimate uses — the Replicated database engine does not require UUID-based paths. The fix is to use toUUIDOrNull in the scanning query so it gracefully skips non-UUID entries.

@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Apr 8, 2026
@alexey-milovidov alexey-milovidov self-assigned this Apr 8, 2026
Merged via the queue into master with commit d1cd1e2 Apr 8, 2026
321 of 322 checks passed
@alexey-milovidov
alexey-milovidov deleted the fix-02859-replicated-db-name-zookeeper branch April 8, 2026 02:16
@robot-ch-test-poll2 robot-ch-test-poll2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Apr 8, 2026
Onyx2406 added a commit to Onyx2406/ClickHouse that referenced this pull request Apr 17, 2026
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.

2 participants