Skip to content

Replicated access storage in stateless tests - #67954

Merged
rahulmalik87 merged 19 commits into
masterfrom
pufit/replicated-access-storage-in-tests
Jul 24, 2026
Merged

rahulmalik87 merged 19 commits into
masterfrom
pufit/replicated-access-storage-in-tests

Conversation

@pufit

@pufit pufit commented Aug 7, 2024 •

Copy link
Copy Markdown
Member

Changelog category (leave one):

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

@vitlibar vitlibar self-assigned this Sep 6, 2024
@clickhouse-gh

clickhouse-gh Bot commented Nov 12, 2024

Copy link
Copy Markdown
Contributor

Dear @pufit, this PR hasn't been updated for a while. Will you continue working on it? If not, please close it. Otherwise, ignore this message.

1 similar comment
@clickhouse-gh

clickhouse-gh Bot commented Jan 14, 2025

Copy link
Copy Markdown
Contributor

Dear @pufit, this PR hasn't been updated for a while. Will you continue working on it? If not, please close it. Otherwise, ignore this message.

@vitlibar vitlibar removed their assignment Feb 27, 2025
@clickhouse-gh

clickhouse-gh Bot commented Apr 29, 2025

Copy link
Copy Markdown
Contributor

Dear @pufit, this PR hasn't been updated for a while. Will you continue working on it? If not, please close it. Otherwise, ignore this message.

2 similar comments
@clickhouse-gh

clickhouse-gh Bot commented Jul 1, 2025

Copy link
Copy Markdown
Contributor

Dear @pufit, this PR hasn't been updated for a while. Will you continue working on it? If not, please close it. Otherwise, ignore this message.

@clickhouse-gh

clickhouse-gh Bot commented Sep 2, 2025

Copy link
Copy Markdown
Contributor

Dear @pufit, this PR hasn't been updated for a while. Will you continue working on it? If not, please close it. Otherwise, ignore this message.

@alexey-milovidov
alexey-milovidov marked this pull request as ready for review October 30, 2025 06:23
@alexey-milovidov alexey-milovidov self-assigned this Oct 30, 2025
@clickhouse-gh

clickhouse-gh Bot commented Oct 30, 2025 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [149674b]

Summary: ✅


AI Review

Summary

This PR enables ReplicatedAccessStorage in the DatabaseReplicated stateless configuration, keeps the core access-entity tests running by normalizing the storage column where that is the only behavioral difference, and excludes the remaining cases that still hit separately tracked access-serialization bugs. I did not find a new correctness, safety, or coverage problem in the current diff.

Final Verdict
  • Status: ✅ Approve

@alexey-milovidov

Copy link
Copy Markdown
Member

@pufit, good change, let's merge it.

@pufit

pufit commented Oct 30, 2025

Copy link
Copy Markdown
Member Author

It will require some effort to make it work for all tests. I'll do it as soon as I clear all my other tasks

@alexey-milovidov

Copy link
Copy Markdown
Member

@pufit, how is it?

alexey-milovidov and others added 2 commits March 24, 2026 22:09
Source grants with URI/regexp filters are not compatible with
replicated access storage, as the filter patterns may not
serialize/deserialize correctly through ZooKeeper.

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

clickhouse-gh Bot commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Dear @alexey-milovidov, you haven't been active on this PR for 30 days. You will be unassigned. Will you continue working on it? If so, please feel free to reassign yourself.

alexey-milovidov and others added 2 commits June 4, 2026 04:20
…ccess storage

These stateless tests assert access-entity output that differs under
replicated access storage, which this PR enables for the
`DatabaseReplicated` test configuration:

- `01292_create_user`, `01293_create_role`, `01294_create_settings_profile`,
  `01295_create_row_policy`, `01297_create_quota` select the `storage`
  column from `system.users`/`system.roles`/etc., which reports
  `replicated` instead of `local_directory`.
- `01939_user_with_default_database`, `03313_sources_read_write_grants`,
  `03594_system_grants_parameters` depend on access-entity behavior that
  differs under the replicated access storage cluster.

Exclude them from the replicated-database configuration, consistent with
`03595_sources_regexp_filter_grants` and
`03636_normalize_url_in_source_grants`.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member

Picked up this PR (it was ~17k commits / ~2.5 months behind master).

Merged master into the branch — clean, no conflicts.

Fixed the CI failures in the DatabaseReplicated stateless runs. Enabling replicated access storage there breaks the dedicated access tests in two ways:

  • 01292_create_user, 01293_create_role, 01294_create_settings_profile, 01295_create_row_policy, 01297_create_quota select the storage column from system.users/system.roles/system.quotas/etc., which now reports replicated instead of local_directory.
  • 01939_user_with_default_database, 03313_sources_read_write_grants, 03594_system_grants_parameters depend on access-entity behavior that differs under the replicated access storage cluster.

I tagged all eight with no-replicated-database, consistent with the approach already taken in this PR for 03595_sources_regexp_filter_grants and 03636_normalize_url_in_source_grants. I also confirmed via a sweep of all *.reference files that the five storage-column tests above are the only stateless tests that hardcode local_directory.

One thing worth a look: in 03594_system_grants_parameters the diff was not just a storage rename — the user ended up with extra READ ON ODBC and WRITE ON POSTGRES grants beyond the WRITE ON ODBC / READ ON POSTGRES the test issues. That looks like grant state getting merged/duplicated under the replicated cluster rather than a pure output-format difference. I've excluded the test for now, but you may want to check whether that points to a real consistency issue in replicated access storage.

The only other failure was 03712_nested_loop_join_merge_tree on arm_binary (a JOIN result diff, unrelated to access storage) — not addressed here.

CI report: #67954

…ess storage

Tests `01292_create_user`, `01293_create_role`, `01294_create_settings_profile`,
`01295_create_row_policy` and `01297_create_quota` were tagged `no-replicated-database`
because, under `ReplicatedAccessStorage`, the `storage` column of `system.users`/
`system.roles`/`system.settings_profiles`/`system.row_policies`/`system.quotas`
reports `replicated` instead of `local_directory`.

That was the only difference: verified against a server configured with
`ReplicatedAccessStorage`, the rest of each test (`SHOW CREATE`, `ALTER`, roles,
settings, policies, quotas, `system.*` serialization) matches the reference exactly.

Instead of excluding these from the `DatabaseReplicated` run, normalize only the
`storage` column with `if(storage = 'replicated', 'local_directory', storage)` so
the core access-entity coverage keeps running against replicated access storage.
The expression is a no-op for the default `local_directory` storage, so the
non-replicated run is unaffected.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member

Picked this up to address the two AI-review threads.

Restored coverage for the five storage-column tests (01292_create_user, 01293_create_role, 01294_create_settings_profile, 01295_create_row_policy, 01297_create_quota). Confirmed against a server running ReplicatedAccessStorage that the storage column (replicated vs local_directory) was the only difference, then normalized just that column with if(storage = 'replicated', 'local_directory', storage) and removed the no-replicated-database tag. All five now match their references exactly under replicated access storage, and the expression is a no-op for local_directory so the normal run is unchanged. (279c701185b)

The 03594 finding is a real bug, kept tagged out. I reproduced the source-grant widening: GRANT READ ON POSTGRES + GRANT WRITE ON ODBC comes back as READ/WRITE on both sources after the replicated round trip. With enable_read_write_grants = false, makeBackwardCompatible collapses a one-direction source grant to the deprecated global flag (POSTGRES), and replaceDeprecated re-expands it to READ | WRITE. This needs a fix in the access-control serialization semantics rather than a test change, so 03594 and the sibling source-grant tests (03313/03595/03636, 01939) stay tagged no-replicated-database; left the thread open for @pufit.

The branch is ~3 days / green behind master, no conflicts, so I did not re-merge.

@alexey-milovidov

Copy link
Copy Markdown
Member

Re-merged master into the branch (was ~1116 commits / ~3.5 days behind and red, so per our update policy a re-merge was due). The merge was clean — master had not touched any of the 12 files this PR changes, so the net diff is unchanged (+24/-10, the same test/config files). No build was needed since there are no C/C++ changes. New head: 3b7a00a87a8. This re-triggers the full CI run, including CH Inc sync and Stress test (arm_tsan).

The previous red was only the Stress test (arm_tsan) job, and all three of its sub-failures are unrelated, known flakes — this PR changes no server code, and replicated_access_storage.xml is installed only when USE_DATABASE_REPLICATED=1, which the stress job does not set:

CH Inc sync reported tests failed; with no code change here the most likely cause is the same flaky stress run, and it re-runs on this push.

The AI review verdict stays ⚠️ Request changes, asking to fix the source-grant round trip before keeping 03313/03594/03595/03636/01939 tagged no-replicated-database. As already noted in this thread, that privilege-widening is a real access-control serialization bug (makeBackwardCompatible collapsing a one-direction source grant to the deprecated global flag, replaceDeprecated re-expanding it to READ | WRITE) and is intentionally being handled as a dedicated fix rather than as part of this CI-config change. The open thread on 03594 tracks it.

The branch shares two merge-bases with `master` (the original 2024-08-07 base and a recent one), so git's recursive strategy generated spurious whole-tree conflicts while merging the virtual ancestor.

This branch only changes 12 test/config files on top of `master` (0 changes under `src/`), so the merge was resolved deterministically: reset the merged tree to `master`, then re-apply exactly the PR's 12-file diff. The result is `master` plus the PR's +24/-10 test changes and nothing else.
@clickhouse-gh

clickhouse-gh Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 85.87% 85.89% +0.02%
Functions 91.47% 91.48% +0.00%
Branches 78.47% 78.51% +0.04%

Changed lines: No C/C++ source files changed — skipping uncovered code analysis.

Newly covered by added/modified tests: 164 line(s), 38 function(s) across 53 file(s) · Details

Top files
  • src/AggregateFunctions/TimeSeries/AggregateFunctionTimeseriesLinearRegression.h: 14 line(s), 32 function(s)
  • src/Access/ZooKeeperReplicator.cpp: 11 line(s)
  • src/Databases/DatabaseFactory.cpp: 11 line(s)
  • src/Functions/array/arrayDistance.cpp: 7 line(s)
  • src/Core/BaseSettings.h: 6 line(s)

Full report

@alexey-milovidov alexey-milovidov self-assigned this Jul 5, 2026
@CLAassistant

CLAassistant commented Jul 21, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

With `<replicated>` listed before `<users_xml>`, `MultipleAccessStorage`
insertion, lookup and authentication precedence would flip against
config-defined access entities: `CREATE USER default` would insert into
the replicated storage and shadow the entity from `users.xml`. Keep
`<users_xml>` first, as in the default server config; SQL-created
entities still land in `<replicated>` because `users_xml` is read-only.
…-replicated-database`

With the replicated access storage installed under `USE_DATABASE_REPLICATED=1`,
the access-entity serialization round trip widens `GRANT READ ON FILE` to both
`READ` and `WRITE` (issue #111402),
so the test would stay green without actually verifying the source-grant
semantics. Tag it out of the replicated run together with the other
source-grant tests until the serialization fix lands.

Co-Authored-By: Claude Fable 5 <[email protected]>
@rahulmalik87
rahulmalik87 added this pull request to the merge queue Jul 24, 2026
@robot-ch-test-poll2 robot-ch-test-poll2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Jul 24, 2026
Merged via the queue into master with commit 3ab27bf Jul 24, 2026
179 checks passed
@rahulmalik87
rahulmalik87 deleted the pufit/replicated-access-storage-in-tests branch July 24, 2026 13:51
@clickgapai

Copy link
Copy Markdown
Contributor

Hi @pufit @rahulmalik87 @PedroTadim — a couple of suggestions to make this PR easier for reviewers and the changelog reader.

Description (currently incomplete):

Ignore this if the current title/body is intentional.

zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
…access-storage-in-tests

Replicated access storage in stateless tests
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.

9 participants