Repository navigation
Add restore_table_data, restore_access_entities, restore_functions settings for RESTORE - #102402
Conversation
Previously, `structure_only=true` skipped restoring access entities (users, roles, quotas, settings profiles, row policies) and user-defined functions. These are structural definitions rather than table data, so they should be restored even when table data is skipped. The issue was in two places: - `loadSystemAccessTables` returned early, preventing access entity metadata from being loaded from the backup - `insertDataToTable` returned early for all tables, including the system access tables and system.functions whose "data" is actually access entity definitions and UDF definitions
|
Workflow [PR], commit [f057f36] Summary: ✅
AI ReviewSummaryThis PR adds granular Missing context / blind spots
Final Verdict✅ No actionable findings. LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 54/61 (88.52%) · Uncovered code |
Add settings_profiles, row_policies, and quotas to the test so all five ACL-backed system tables are exercised.
|
I don't quite understand the idea. |
…lity Keep structure_only behavior unchanged (does not restore access entities or UDFs). Add a new structure_only_restore_definitions setting that, when used together with structure_only=true, also restores access entities (users, roles, settings profiles, row policies, quotas) and user-defined functions. The test now verifies both: - structure_only alone does NOT restore access entities (backward compat) - structure_only + structure_only_restore_definitions restores them
|
The use case is to test restores without data, but restore access entities to use them in internal replay tool. To keep backward compatibility, I've added a separate setting |
This can be done in two commands: |
Probably the clearest solution would be to add three settings: and thus make setting |
alexey-milovidov
left a comment
There was a problem hiding this comment.
Do not merge before fixing "Logical error: '!res.empty()' (STID: 2508-3ea0)"
It's not configurable in the cloud restores. it's managed by dataplane
I don't want to introduce backward incompatibilities because of testing-only setting |
Just add 3 settings and handle |
Add restore_table_data, restore_access_entities, restore_functions settings (optional bools). When not set, they default based on structure_only (true when structure_only is false, false when it is true). When explicitly set, they override structure_only. This allows e.g.: RESTORE ... SETTINGS structure_only=true, restore_access_entities=true to restore table structure + access entities without table data, while keeping full backward compatibility with structure_only=true.
…re_only` The `checkAccessForObjectsFoundInBackup` pre-check was still gating INSERT privilege on `!structure_only`, but actual data restore now uses `shouldRestoreTableData`. This made the access validation inconsistent: `structure_only=true, restore_table_data=true` would skip the INSERT privilege check but then attempt inserts during execution.
Verify that when `restore_table_data` is explicitly enabled alongside `structure_only`, table rows are restored while access entities and UDFs remain absent.
Verify that UDFs are not restored when only restore_table_data is enabled alongside structure_only.
|
🕵 Status update (automated): the previous CI run on |
The test asserts that `MemoryPeak` events with `memory_context = 'Global'` appear in `system.trace_log`, but such events are sent only when the server-wide memory usage grows past its previous peak by at least `total_memory_profiler_step` (4 MiB). When the peak reached during server startup is higher than anything the test's small queries allocate, no `MemoryPeak` event can ever be produced and the existing retry loop cannot help - the test fails with `assert 0 > 0`. Force a new global peak by allocating an increasing amount of memory (~100 MB more per attempt) inside the retry loop. Seen in https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=102402&sha=f8b38f834a2e63df6820ad1e750205d84276799a&name_0=PR&name_1=Integration%20tests%20%28arm_binary%2C%20distributed%20plan%2C%202%2F4%29 of ClickHouse#102402 Co-Authored-By: Claude Fable 5 <[email protected]>
alexey-milovidov
left a comment
There was a problem hiding this comment.
🕵 The previously requested !res.empty() fix applied to the superseded design. The current granular-settings implementation gates ACL restore correctly; all outstanding inline feedback is addressed.
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
Only the stripped binary is compared: the official master build keeps debug symbols while PR builds strip them, so the other binaries differ by construction. Object file sizes19 object files changed (+57.43 KiB total), 1 added.
737 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only Compile time of recompiled translation units33 translation units recompiled, 243 s compile time in total, 32 of them have a recent master baseline. |
|
🕵 Merged current |
Add three new optional restore settings that give granular control over what gets restored:
restore_table_data— whether to restore table data (default:true, orfalsewhenstructure_only=true)restore_access_entities— whether to restore users, roles, settings profiles, row policies, quotas (default:true, orfalsewhenstructure_only=true)restore_functions— whether to restore user-defined functions (default:true, orfalsewhenstructure_only=true)When not explicitly set, these default based on
structure_only: all three aretruenormally, all three arefalsewhenstructure_only=true. When explicitly set, they overridestructure_only. This is fully backward compatible.Example — restore table structure + access entities without table data:
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Add
restore_table_data,restore_access_entities, andrestore_functionsrestore settings for granular control over what gets restored. These can overridestructure_onlyfor individual categories — e.g.structure_only=true, restore_access_entities=truerestores table definitions and access entities without table data.Documentation entry for user-facing changes
Documented in
docs/concepts/features/backup-restore/restore-settings.mdx(registered in the "Backup and restore" navigation group), and in the BACKUP/RESTORE settings table rendered by the backup and restore overview.Three new optional Bool restore settings:
restore_table_data,restore_access_entities,restore_functions. When not set, they followstructure_only. When explicitly set, they override it.Version info
26.8.1.1550(included in26.8and later)