-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Skip FailedStorage in background scan #26529
Conversation
@PVince81, thanks for your PR! By analyzing the history of the files in this pull request, we identified @DeepDiver1975, @icewind1991 and @Xenopathic to be potential reviewers. |
The "FailedScanner" class doesn't follow the expected return values from the "IScanner" class. We need either adjust the "FailedScanner" class to return proper values according the interface, or change the documentation in the "IScanner" class. We also should check if returning "false" is being handled correctly by the system because, again, the interface doesn't say a boolean can be returned in those methods. |
cd2b4a7
to
e46add8
Compare
@jvillafanez I've adjusted the return values to be |
Any other "FailedThing" we should provide, such as propagator, watcher, etc? Last time I checked this, the storage was pretty coupled with all these components. |
@jvillafanez good point. Or maybe we just throw directly if someone calls These FS APIs could really use a good refactor. |
Tests passed but unpublished |
e46add8
to
df49fa1
Compare
@jvillafanez I added the methods Retested with some unavailable storage scenarios like fed share, ext storage, still works fine with:
|
I don't think it's a good idea to throw that exception there and return an instance in the other methods. I think it's more natural to either return "null" or "false", or return a "FailedWhatever", than throwing an exception. Suppose that I get an storage instance (which I don't know and I don't care if it's a FailedStorage), and I request to get the watcher. A "StorageNotAvailable" exception thrown there is completely unexpected, specially if other methods such as the "getCache" returns an instance fine. In addition, the "StorageNotAvailable" is suppose to be thrown when you're accessing the backend, but those method don't access to the backend. |
Yeah, you're right... consistency is key. |
We have to patch one thing or another: either all the places where this is used accept "null" or we need to make sure all the methods return an instance. |
You know what... I think I'm going to remove these bullshit classes and restrict the fix to only checking in the background job and be done with it. There are more important things to work on. |
The background job that scans storages must skip failed storages to avoid potential exceptions, especially when the failed storage comes from a shared storage where the source is not accessible.
df49fa1
to
26e0ce6
Compare
I have now simplified the PR to the minimum required to make it work and fix the issue. Please review. |
Maybe a log to know what storages are being skipped. Other than that 👍 |
stable9.1: #26977 |
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. |
Description
The background job that scans storages must skip failed storages to
avoid potential exceptions, especially when the failed storage comes
from a shared storage where the source is not accessible.
This fix adds not only a check for FailedStorage in the background scanner but also hardens the FailedStorage class with a new FailedScanner class to prevent trying to scan into the failed storage.Note that the latter hardening is not needed directly for the fix thanks to the extra check in the background job but could be useful to catch other code paths that might reach the scanner part.
Additionally this also skips unavailable external storages earlier.
Related Issue
Fixes #26055
Read from #26055 (comment)
Motivation and Context
How Has This Been Tested?
See steps
Screenshots (if appropriate):
Types of changes
Checklist:
Backports:
Utils/Scanner.php
but not the newFailedScanner
classPlease review @jvillafanez @DeepDiver1975