-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New cache state #38804
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
Merged
Merged
New cache state #38804
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
c39f3fc
Add proper "is shallow scanned" state to avoid rescanning folders
jvillafanez 45f6675
Recalculate folder size if it's shallow scanned
jvillafanez 732afca
Don't change size to "shallow scanned" if folder has been scanned before
jvillafanez 53dcf3d
Adjust unit tests
jvillafanez 130faa9
Remove code not needed any longer
jvillafanez e300cbd
Add changelog entry
jvillafanez f877a96
CI fixes
jvillafanez File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| Enhancement: Introduce new state to prevent scanning of shallow scanned folders | ||
|
|
||
| Folders can be partially scanned, this means that a folder could have its closest | ||
| contents scanned (the first level), but not deeper contents. Folder "/A" could be | ||
| scanned but not "/A/B/C". | ||
|
|
||
| Previously, we couldn't detect that a folder had been partially scanned, so we | ||
| triggered another scan on that folder even though we already had data in the DB. | ||
|
|
||
| Now, we can detect that the folder has been partially scanned to avoid another | ||
| scan if it isn't needed. This leads to notable performance improvements in cases | ||
| where a FS hasn't been scanned fully. Note that an initial scan is still required, | ||
| and the performance will remain the same in this case. | ||
|
|
||
| https://github.com/owncloud/core/pull/38804 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -53,6 +53,7 @@ | |
| use OCP\Constants; | ||
| use OCP\Events\EventEmitterTrait; | ||
| use OCP\Files\Cache\ICacheEntry; | ||
| use OCP\Files\Cache\IScanner; | ||
| use OCP\Files\FileNameTooLongException; | ||
| use OCP\Files\InvalidCharacterInPathException; | ||
| use OCP\Files\InvalidPathException; | ||
|
|
@@ -1399,7 +1400,7 @@ private function getCacheEntry($storage, $internalPath, $relativePath) { | |
|
|
||
| try { | ||
| // if the file is not in the cache or needs to be updated, trigger the scanner and reload the data | ||
| if (!$data || (isset($data['size']) && ($data['size'] === -1))) { | ||
| if (!$data || (isset($data['size']) && ($data['size'] === IScanner::SIZE_NEEDS_SCAN))) { | ||
| $this->lockFile($relativePath, ILockingProvider::LOCK_SHARED); | ||
| if (!$storage->file_exists($internalPath)) { | ||
| $this->unlockFile($relativePath, ILockingProvider::LOCK_SHARED); | ||
|
|
@@ -1415,6 +1416,8 @@ private function getCacheEntry($storage, $internalPath, $relativePath) { | |
| $storage->getPropagator()->propagateChange($internalPath, \time()); | ||
| $data = $cache->get($internalPath); | ||
| $this->unlockFile($relativePath, ILockingProvider::LOCK_SHARED); | ||
| } elseif ($data['size'] === IScanner::SIZE_SHALLOW_SCANNED) { | ||
| $cache->correctFolderSize($internalPath, $data); | ||
|
Member
Author
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. Lock shouldn't be needed because we don't hit the storage... should we propagate the change using the propagator? |
||
| } | ||
| } catch (LockedException $e) { | ||
| // if the file is locked we just use the old cache info | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.