Restore RBAC objects across different user_directories types - #1549
Open
Slach wants to merge 2 commits into
Open
Restore RBAC objects across different user_directories types#1549Slach wants to merge 2 commits into
Slach wants to merge 2 commits into
Conversation
RBAC objects live either in a `local_directory` user directory as `<access_control_path>/<uuid>.sql` files, or in a `replicated` one as znodes under `<zookeeper_path>`. A backup carries both shapes, but restore only ever routed each half into the storage it came from, so restoring onto a server with a different user_directories layout silently dropped half of the backup while still reporting success: a Keeper dump had no target and was skipped, and *.sql files were copied into a directory clickhouse-server does not read. The serialized entity blob is byte identical in both storages (serializeAccessEntity in DiskAccessStorage.cpp and ZooKeeperReplicator.cpp), so the conversion is a file/znode move plus the `<type char>/<escaped name>` index znode, no SQL rewriting and no UUID remapping. Restore now converts whichever half has no matching target storage, and fails explicitly when the server has neither a local nor a replicated user directory instead of reporting success. The local-directory probe in isRBACExists is gated on the presence of a `local_directory` user directory, so dropExistsRBAC can no longer remove *.sql files from a directory clickhouse-server does not read. keeper gains WalkDumpFile, Upsert, EnsureNode and ResolvePath, shared by Restore, the conflict resolver and the new converters; this also fixes the legacy DumpNodeString fallback in Restore, which parsed old-format dumps but never copied the result back, restoring empty znodes. fix #881 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Keep ReadMe.md focused on configuration and commands, the how-to text belongs next to the other use cases in Examples.md, linked from the ReadMe.md examples list like the rest of them. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix #881
RBAC objects live either in a
local_directoryuser directory as<access_control_path>/<uuid>.sqlfiles, or in areplicatedone as znodes under<zookeeper_path>. A backup carries both shapes, but restore only ever routed each half into the storage it came from, so restoring onto a server with a different user_directories layout silently dropped half of the backup while still reporting success: a Keeper dump had no target and was skipped, and *.sql files were copied into a directory clickhouse-server does not read.The serialized entity blob is byte identical in both storages (serializeAccessEntity in DiskAccessStorage.cpp and ZooKeeperReplicator.cpp), so the conversion is a file/znode move plus the
<type char>/<escaped name>index znode, no SQL rewriting and no UUID remapping. Restore now converts whichever half has no matching target storage, and fails explicitly when the server has neither a local nor a replicated user directory instead of reporting success.The local-directory probe in isRBACExists is gated on the presence of a
local_directoryuser directory, so dropExistsRBAC can no longer remove *.sql files from a directory clickhouse-server does not read.keeper gains WalkDumpFile, Upsert, EnsureNode and ResolvePath, shared by Restore, the conflict resolver and the new converters; this also fixes the legacy DumpNodeString fallback in Restore, which parsed old-format dumps but never copied the result back, restoring empty znodes.