Skip to content
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

add command to repair broken filesystem trees #25189

Merged
merged 4 commits into from
Jan 27, 2021
Merged

Conversation

icewind1991
Copy link
Member

If for any reason the path of an entry in the filecache doesn't match with it's expected path based on the path of it's parent node you end up with an entry in the filecache that exists in different places based on how the entry is generated. For example, while listing folder /foo is contains a file bar.txt, but when trying to do anything with /foo/bar.txt the file doesn't exists.

This command attempts to repair such entries by querying for entries there the path doesn't match the expected path based on it's parent path and filename and resets it's path to the expected one.

It is not guaranteed that the "new" path is the correct one, but while that would leave the filecache and actual filesystem out of sync, various automated and manual processes to fix that already exist as filecache synchronization is a much wider topic.
By comparison there isn't currently any way (short of manual database editing) to repair a broken file tree.

@icewind1991 icewind1991 added the 3. to review Waiting for reviews label Jan 18, 2021
@icewind1991 icewind1991 added this to the Nextcloud 21 milestone Jan 18, 2021
@rullzer rullzer mentioned this pull request Jan 19, 2021
15 tasks
Copy link
Member

@rullzer rullzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense
But I didn't test it. Is there an easy way to test it?

@icewind1991
Copy link
Member Author

you can manually break your filesystem tree by changing the path and path_hash of a filesystem entry without changing the parent

@rullzer rullzer mentioned this pull request Jan 21, 2021
19 tasks
@icewind1991 icewind1991 force-pushed the file-tree-repair branch 2 times, most recently from 9884fc2 to ef9f205 Compare January 26, 2021 19:25
Copy link
Member

@nickvergessen nickvergessen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

Signed-off-by: Robin Appelman <robin@icewind.nl>
Signed-off-by: Robin Appelman <robin@icewind.nl>
…y been recreated

Signed-off-by: Robin Appelman <robin@icewind.nl>
Copy link
Member

@ChristophWurst ChristophWurst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code makes sense as far as I understand the file cache

👍 (🐘)

Signed-off-by: Robin Appelman <robin@icewind.nl>
@rullzer rullzer merged commit 81caefb into master Jan 27, 2021
@rullzer rullzer deleted the file-tree-repair branch January 27, 2021 20:00
@PVince81
Copy link
Member

PVince81 commented Feb 1, 2021

would be good to have unit tests to confirm that this isn't causing any side effects

something like https://github.com/owncloud/core/pull/28253/files#diff-61c2bd81935832b24f87e329f7b6374aa736b3d7c74196581abe0892d983303e

@icewind1991
Copy link
Member Author

/backport to stable20

@icewind1991
Copy link
Member Author

/backport to stable19

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants