-
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
[6.0.3] Files uploaded directly to SWIFT storage don't show up in oC #8633
Comments
As discussed, might be an issue with the mtime of the SWIFT root. |
CC @icewind1991 |
iirc we decided not to support this use case for the swift backends since swift doesn't handle nested directories itself and thus we need to emulate it by storing additional meta-data |
I checked the other headers and haven't found yet how to detect whether ANY change has been done on the SWIFT server. As for the directory structure, the only thing that isn't emulated is the propagation of mtime from a subdirectory to parent directories. This would be an additional issue. |
Looking through the docs I have the feeling that it's not possible to get a timestamp or date for the bucket itself (the root). The alternative would be to do a full rescan, or a cron job, or something that would sync it. As for the scanning, we might be able to use range requests on the object list. I saw in the API that it's possible to retrieve the list in a paginated manner. The scanner wouldn't need to make calls for every subdir but just take the whole list at once... still might not be good for performance and memory. Also might be a much bigger change. I'll continue my research. |
I've asked on IRC #openstack-swift and was told that it isn't currently possible. |
I was suggested to write a SWIFT middleware that would detect changes on the server (not sure how) and then send notifications. |
One possible workaround for the mtime issue: provide a "root" field and let users put their files into a specific folders on the SWIFT server. We should be able to detect the mtime of that folder since it has an entry on the object store. |
We created a sub folder in the SWIFT storage in ownCloud |
@ser72 ok, thanks for the info. |
I can't test this because the Rackspace UI doesn't accept folders, only files. If the folder case doesn't work, it is likely to be because whichever program or UI they use to upload a file, that program doesn't automatically update the folder's mtime, which makes it impossible to detect changes. For example, if the object store contains these entries:
When uploading a file into the subdir, it will simply add a new entry called "subdir/newfile_in_subdir.txt" and will probably not change the mtime of the "subdir/" entry, which our code checks to find whether there are changes. I have the feeling that detecting changes is close to impossible with SWIFT interfaces without resorting to either getting notifications from the object store itself (needs architectural additions / development of object store specific plugins) OR often doing a full rescan. Doing a full rescan might be possible but the performance is likely to be very bad. |
@icewind1991 would it be possible to trigger a rescan specifically for a given storage using a cron job ? |
Not possible at the moment, would be fairly easy to write an app for it |
Any updates on this issue? |
The only possibility I see for now is to poll the server for changes (bad performance), trigger a rescan regularly. I need support from @icewind1991 for the rescan/cron job part. |
@ser72 I guess you already tried running |
@PVince81 Don't recall, off hand, if we did that. Just requested it be done and will let you know the results. |
@PVince81 Did the file scan and the updates were still not there... |
Actually it should be But based on what I found out today about etag propagation, there is only a minor chance that this works. |
./occ files:scan --all made the files visible. Need to cron that as a work around |
Any updates on a permanent fix? |
No updates. SWIFT is the most tricky ext storage. Once idea like suggested before by @icewind1991 is to make |
i've witnessed the same behaviour with S3 as the external storage, i'm assuming it's the same problem. |
after writing the objectstore and having had a look at the issue I agree with @PVince81 that we cannot easily detect if something has changed on the swift/s3 side. They do not propagate mtime changes up the pseudo file hierarchy (because it's an object store ... duh) and likely never will. For swift the proper solutuion IMHO would be to implement a SWIFT middleware that notifies owncloud of changes. I don't see that kind of solution for s3 though. In the meantime a cron job to scan and compare the mtimes of all files may be a viable solution. Depending on how long that takes files will show up after some time. It will however create quite some traffic and load on the db. |
Add a release note for ownCloud 7, as this is true for SWIFT and S3 external storage. Can't reach around ownCloud in these situations, it doesn't detect automatically. |
Follow on thought: the config.php setting in oC 7 does allow external storage to set a scanfile action when external storage is accessed. Does this solve this problem? |
I'm not aware of any such addition. |
Ah, maybe you mean "filesystem_check_changes" set to 2 ? |
|
#10885 on the other hand... :) |
From the user who found this issue: That is to say, it all works fine on the top-level directory. As soon as you allow ownCloud to build a subdirectory structure within the secodary storage OpenStack swift space, inconsistenceis appear, with (just as an example) the OpenStack swift dashboard not showing contents of the subdirectories if that content was placed there by ownCloud. |
That is a known limitation of the current implementation. Swift and s3 only emulate directories. As a result the mtime change to a file is not propagated up the directory tree, which we would need to have a cheap way (one http call) to detect changes in the external storage. I see two solutions:
1 is not a viable solution because we have ti iterate over all files in swift/s3 which will take too long to do it on demand Unfortunately 2. comes at a cost for s3 users because they have to pay for the arising traffic. But I still think it is our best bet. Also note that #11375 now makes all users reuse the same filecache for s3 mounts, which makes rescanning unnecessary when all access happens through owncloud. |
cc @PVince81 @icewind1991 for an opinion on the background scanning of externat swift/s3 storages |
At some point I asked the openStack guys on IRC and they said one should implement a SWIFT middleware that would detect changes and then notify OC about such. But I have no idea how such a middleware could be written... it is likely that the middleware itself would still need to scan the SWIFT storage to find about changes, unless it's possible to have hooks. So for now it seems the only solution is to do a full rescan periodically. |
@icewind1991 What about a scanner that scans all objects at once, instead of descending the tree. That would certainly improve scan performance on s3 and swift. It could then be executed as a background job or after a configurable timeout. I'll look into it tomorrow, but your input is very welcome! |
Needs additional discussion in #11797 |
added to release notes |
Given that release notes have been updated, I'm marking this as a duplicate of #11797 |
Steps
IMAGES
Swift storage -- the last file is uploaded directly to SWIFT. The other 2 were uploaded via oC.
oC. Notice the missing file
The text was updated successfully, but these errors were encountered: