Skip to content

handle completely unscanned storages in the background scanner - #23561

Merged
2 commits merged into
masterfrom
background-scan-unscanned
Apr 14, 2016
Merged

2 commits merged into
masterfrom
background-scan-unscanned

Conversation

@icewind1991

Copy link
Copy Markdown
Contributor

Fixes #13876

previously if there were no cache entries for a storage (folder containing the storage has never been visited after the storage has been added) the background scanner is not triggered, this fixes it by triggering a full scan if the storage is unscanned.

cc @PVince81 @mmattel

@icewind1991 icewind1991 added this to the 9.1-current milestone Mar 24, 2016
@mention-bot

Copy link
Copy Markdown

By analyzing the blame information on this pull request, we identified @PVince81, @nickvergessen and @mmattel to be potential reviewers

Comment thread lib/private/files/cache/scanner.php Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We should also catch the exceptions here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

@icewind1991
icewind1991 force-pushed the background-scan-unscanned branch from 351193f to 43ab870 Compare March 24, 2016 14:25
Comment thread lib/private/files/cache/scanner.php Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

and what about this hook ?

It rather looks like the "try" block should be moved to a function and called from both places ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Another quicker solution: only scan the root, non-recursive, to auto-create the root entry with size -1. And then proceed with the regular while

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Another quicker solution: only scan the root, non-recursive, to auto-create the root entry with size -1. And then proceed with the regular while

A bit more ugly imo and will result in the same thing (the entire thing being scanned)

@icewind1991
icewind1991 force-pushed the background-scan-unscanned branch from 43ab870 to 8a2c6ac Compare March 24, 2016 14:32
@PVince81

Copy link
Copy Markdown
Contributor

Second review @mmattel @Xenopathic @nickvergessen @blizzz ?

@karlitschek backport to stable9 ?

@PVince81

Copy link
Copy Markdown
Contributor

@icewind1991 please fix the unit test

Test\Files\Cache\Scanner::testBackgroundScan
Undefined variable: path

/ssd/jenkins/workspace/core-ci-linux/database/sqlite/label/SLAVE/lib/private/files/cache/scanner.php:471
/ssd/jenkins/workspace/core-ci-linux/database/sqlite/label/SLAVE/lib/private/files/cache/scanner.php:460
/ssd/jenkins/workspace/core-ci-linux/database/sqlite/label/SLAVE/tests/lib/files/cache/scanner.php:142

@icewind1991
icewind1991 force-pushed the background-scan-unscanned branch from 8a2c6ac to 6485d95 Compare March 24, 2016 16:16
@karlitschek

Copy link
Copy Markdown
Contributor

great. please backport

@icewind1991

Copy link
Copy Markdown
Contributor Author

@icewind1991 please fix the unit test

Fixed

@icewind1991

Copy link
Copy Markdown
Contributor Author

stable9: #23576

@mmattel

mmattel commented Mar 25, 2016

Copy link
Copy Markdown
Contributor

@icewind1991

  • Rebased my testinstance and applied this PR
  • Added a big enough new and never before used SMB share (green light at the admin page)
  • Back in files it shows "Ausstehend" (Pending)
  • Monitoring via htop processor activities - more or less nothing during the next 15min
  • Monitoring oc_filecache table filtering the corresponding storage ID, no changes except one entry (parent = -1)
  • Double check if the PR has really been applied = ok
  • Nothing in the log

@mmattel

mmattel commented Mar 25, 2016

Copy link
Copy Markdown
Contributor
  • No changes after log off an relogon
  • No changes now after about 20min
  • No changes even admin page tells, last cron run 14 min ago respectively just now

UPDATE:
After now about 30 min (can not determine exactly), the scanner started (htop showed load), oc_filecache has been filled and on the files page, the new SMB storage shows the size.
The PR is working.

Question: There is a long time between adding a storage and starting the background scan.
I excpected a delay of less than 5min. And the message on the admin page that the last cron run but nothing hapened was very confusing in this situation.

@PVince81

Copy link
Copy Markdown
Contributor

@mmattel good point... the reason it starts late is because of the time where cron runs.
Not sure how to solve this, maybe automatically reset that job's last_run ?
Or add a new temp bkg job after creating the storage ?

@icewind1991

@mmattel

mmattel commented Mar 29, 2016

Copy link
Copy Markdown
Contributor

Just thinking around:

  1. If you create an external storage, wait for 3-5min (tbd) to start the background job. Trigger for the timer is the green light = storage is successfully attachable.
  2. If in the meanwhile of this waiting time something has changed on the storage settings, restart the timer.
  3. If you delete the storage during the waiting time, delete the background job.
  4. If you change to files AND open on the newly created storage which has not been scanned, start scanning immediately = set the delay timer to zero.

In the current implementation, what happens on 3?
Does the backgrund job start on an non existing storage?

@icewind1991

Copy link
Copy Markdown
Contributor Author

In the current implementation, what happens on 3?
Does the backgrund job start on an non existing storage?

The background job is not storage specific so it will be handled just fine.

For now I would just go with the current approach since it's only for showing the folder size in the web ui, the external storage will always be accessible no matter when or if the background job fires

@lock

lock Bot commented Aug 6, 2019

Copy link
Copy Markdown

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock Bot locked as resolved and limited conversation to collaborators Aug 6, 2019
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Folder Size does not get calculated

7 participants