diff --git a/src/Backups/BackupSettings.h b/src/Backups/BackupSettings.h index 6482237e77f..8c2ea21df01 100644 --- a/src/Backups/BackupSettings.h +++ b/src/Backups/BackupSettings.h @@ -80,7 +80,7 @@ struct BackupSettings /// Whether dependents of access entities should be written along with the access entities. /// For example, if a role is granted to a user and we're making a backup of system.roles (but not system.users) /// this is whether the backup will contain information to grant the role to the corresponding user again. - bool write_access_entities_dependents = false; + bool write_access_entities_dependents = true; /// Internal, should not be specified by user. /// Whether this backup is a part of a distributed backup created by BACKUP ON CLUSTER. diff --git a/src/Backups/RestoreSettings.h b/src/Backups/RestoreSettings.h index e8101cdd71c..ad027b83354 100644 --- a/src/Backups/RestoreSettings.h +++ b/src/Backups/RestoreSettings.h @@ -108,7 +108,7 @@ struct RestoreSettings /// and now we're restoring only user `u2` and role `r2` doesn't exist, then /// this flag is whether RESTORE should continue with restoring user `u2` without that grant. /// If this flag is false then RESTORE will throw an exception in that case. - bool skip_unresolved_access_entities_dependencies = false; + bool skip_unresolved_access_entities_dependencies = true; /// Try to update dependents of restored access entities. /// For example: if a backup contains a profile assigned to a user: `CREATE PROFILE p1; CREATE USER u1 SETTINGS PROFILE p1` @@ -118,7 +118,7 @@ struct RestoreSettings /// and now we're restoring only role `r2` and user `u2` already exists, then /// this flag is whether restored role `r2` should be granted to user `u2` again. /// If this flag is false then RESTORE won't update existing access entities. - bool update_access_entities_dependents = false; + bool update_access_entities_dependents = true; /// How the RESTORE command will handle if a user-defined function which it's going to restore already exists. RestoreUDFCreationMode create_function = RestoreUDFCreationMode::kCreateIfNotExists; diff --git a/tests/queries/0_stateless/03231_restore_user_with_existing_role.sh b/tests/queries/0_stateless/03231_restore_user_with_existing_role.sh index 8ff23b2467d..6aa8b22de10 100755 --- a/tests/queries/0_stateless/03231_restore_user_with_existing_role.sh +++ b/tests/queries/0_stateless/03231_restore_user_with_existing_role.sh @@ -19,7 +19,7 @@ CREATE USER ${user_a} DEFAULT ROLE ${role_b} SETTINGS custom_x=2; backup_name="Disk('backups', '${CLICKHOUSE_TEST_UNIQUE_NAME}')" -${CLICKHOUSE_CLIENT} --query "BACKUP TABLE system.users, TABLE system.roles TO ${backup_name} SETTINGS write_access_entities_dependents = true FORMAT Null" +${CLICKHOUSE_CLIENT} --query "BACKUP TABLE system.users, TABLE system.roles TO ${backup_name} FORMAT Null" ${CLICKHOUSE_CLIENT} --query "RESTORE ALL FROM ${backup_name} FORMAT Null" do_check() @@ -57,7 +57,7 @@ do_check echo "Role dropped" ${CLICKHOUSE_CLIENT} --query "DROP ROLE ${role_b}" -${CLICKHOUSE_CLIENT} --query "RESTORE ALL FROM ${backup_name} SETTINGS update_access_entities_dependents=true FORMAT Null" +${CLICKHOUSE_CLIENT} --query "RESTORE ALL FROM ${backup_name} FORMAT Null" do_check echo "Nothing dropped" @@ -84,8 +84,8 @@ do_check echo "Everything dropped, restore system.users, then system.roles" ${CLICKHOUSE_CLIENT} --query "DROP USER ${user_a}" ${CLICKHOUSE_CLIENT} --query "DROP ROLE ${role_b}" -${CLICKHOUSE_CLIENT} --query "RESTORE TABLE system.users FROM ${backup_name} SETTINGS skip_unresolved_access_entities_dependencies=true FORMAT Null" +${CLICKHOUSE_CLIENT} --query "RESTORE TABLE system.users FROM ${backup_name} FORMAT Null" ${CLICKHOUSE_CLIENT} --query "SELECT 'user_a', count() FROM system.users WHERE name = '${user_a}'" ${CLICKHOUSE_CLIENT} --query "SELECT 'role_b', count() FROM system.roles WHERE name = '${role_b}'" -${CLICKHOUSE_CLIENT} --query "RESTORE TABLE system.roles FROM ${backup_name} SETTINGS update_access_entities_dependents=true FORMAT Null" +${CLICKHOUSE_CLIENT} --query "RESTORE TABLE system.roles FROM ${backup_name} FORMAT Null" do_check