-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MDB-21949 Use tmp folder for restore/backup access control entities #155
Changes from 5 commits
062a06f
2db688a
9d1dbd8
478c79f
0dbe46b
b975275
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -466,3 +466,23 @@ def __eq__(self, other): | |
if not getattr(self, slot) == getattr(other, slot): | ||
return False | ||
return True | ||
|
||
|
||
def chown_path(path: str, user: str, group: str) -> None: | ||
""" | ||
Interface for chown | ||
""" | ||
shutil.chown(path, user, group) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we really need to wrap this function with exact the same interface under a custom name then? originally it was done only for using our context There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. seems like unused function and can be deleted? |
||
|
||
|
||
def copy_directory_content(from_path_dir: str, to_path_dir: str) -> None: | ||
""" | ||
Copy all files from one directory to another. | ||
""" | ||
if to_path_dir[-1] != "/": | ||
to_path_dir += "/" | ||
for subpath in os.listdir(from_path_dir): | ||
subpath_from = os.path.join(from_path_dir, subpath) | ||
subpath_to = os.path.join(to_path_dir, subpath) | ||
if not os.path.exists(subpath_to): | ||
shutil.copy(subpath_from, to_path_dir) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm, am I right that now
_backup_replicated()
just copies data from ZK to tmp dir, while_backup_local()
copies local files from access path to tmp and that's it?And so:
_backup_local
will always replace (in case of replicated storage) actual data from ZK with local version (because currently we do not clean them up)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, seem we should do not replace it, if we already have the same one, but replicated.
Yes, we will have it. I think make sense to cleanup
/var/lib/clickhouse/access
in restore operation.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because I thought that originally we could have potential issue with local copies after each backup - in case of troubles with ZK we can't use replicated storage - so we can have a conflict with local sql files
so maybe we should clean it up after backup operation as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Im not sure because suppose:
/var/lib/clickhouse/acces
.It seems fine to do cleanup on restore, but we will lose non-replicated records when we do a backup.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it already possible to have 2 entities in different storages (local and replicated)? because I've tested it initially (22.x), and found that you can use only one storage type for that (if already no - maybe it makes sense)
and if 1 possible storage is still relevant - it's better to clean it up after a backup as well (think about your current state on the clusters - they all have local files), or move/remove them during migration from replicated to local
otherwise I think current approach works only for new clusters and with new ch-backup version