You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[6.0.3] Files uploaded directly to SWIFT storage don't show up in oC #8633
As discussed, might be an issue with the mtime of the SWIFT root.
From what I remember seeing is that the root mtime is always the "creation time of the bucket" and it never updates itself.
We might need to find another way to detect changes there.
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've asked on IRC #openstack-swift and was told that it isn't currently possible.
They suggested reload the whole list and comparing the mtimes to the known ones, which is inconvenient.
And then, they said it would be cool if it was possible to sort results (the object list) by mtime, which isn't possible at the moment.
I was suggested to write a SWIFT middleware that would detect changes on the server (not sure how) and then send notifications.
If that would be possible, it means that after the initial scan we could rely on the notifications to update the file cache. But that seems like a lot of work and not at all a simple solution.
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.
One prerequisites is however that whichever tool is used to upload files must also automatically update the mtime of the folders, which would make it possible to detect changes from ownCloud.
We created a sub folder in the SWIFT storage in ownCloud
Then we uploaded a file directly to the SWIFT storage (bypassing ownCloud) in that subfolder
Going back into ownCloud, the file did not exist.
I can't test this because the Rackspace UI doesn't accept folders, only files.
From the screenshot it looks like they are using Nectar, another provider.
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.
A partial rescan could be possible based on the currently accessed folder, but requires checking all files in subfolders. When accessing root, the whole store would be rescanned.
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:
always do a full scan of the external storage when it is accessed
periodically do a full scan of the external storage in the background
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
2. still takes several http calls to iterate over all objects in swift/s3 but will allow for eventual consistency, depending on the rescan frequency..
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.
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!
Activity
PVince81 commentedon May 19, 2014
As discussed, might be an issue with the mtime of the SWIFT root.
From what I remember seeing is that the root mtime is always the "creation time of the bucket" and it never updates itself.
We might need to find another way to detect changes there.
PVince81 commentedon May 19, 2014
CC @icewind1991
icewind1991 commentedon May 19, 2014
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
PVince81 commentedon May 19, 2014
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.
PVince81 commentedon May 19, 2014
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.
PVince81 commentedon May 19, 2014
I've asked on IRC #openstack-swift and was told that it isn't currently possible.
They suggested reload the whole list and comparing the mtimes to the known ones, which is inconvenient.
And then, they said it would be cool if it was possible to sort results (the object list) by mtime, which isn't possible at the moment.
PVince81 commentedon May 19, 2014
I was suggested to write a SWIFT middleware that would detect changes on the server (not sure how) and then send notifications.
If that would be possible, it means that after the initial scan we could rely on the notifications to update the file cache. But that seems like a lot of work and not at all a simple solution.
PVince81 commentedon May 19, 2014
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.
One prerequisites is however that whichever tool is used to upload files must also automatically update the mtime of the folders, which would make it possible to detect changes from ownCloud.
ser72 commentedon May 22, 2014
@PVince81
We created a sub folder in the SWIFT storage in ownCloud
Then we uploaded a file directly to the SWIFT storage (bypassing ownCloud) in that subfolder
Going back into ownCloud, the file did not exist.
PVince81 commentedon May 22, 2014
@ser72 ok, thanks for the info.
This needs more investigation. I guess it should be at least possible to make the detection work in a subfolder.
PVince81 commentedon May 22, 2014
I can't test this because the Rackspace UI doesn't accept folders, only files.
From the screenshot it looks like they are using Nectar, another provider.
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.
A partial rescan could be possible based on the currently accessed folder, but requires checking all files in subfolders. When accessing root, the whole store would be rescanned.
PVince81 commentedon May 22, 2014
@icewind1991 would it be possible to trigger a rescan specifically for a given storage using a cron job ?
30 remaining items
butonic commentedon Oct 10, 2014
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
2. still takes several http calls to iterate over all objects in swift/s3 but will allow for eventual consistency, depending on the rescan frequency..
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.
butonic commentedon Oct 10, 2014
cc @PVince81 @icewind1991 for an opinion on the background scanning of externat swift/s3 storages
PVince81 commentedon Oct 13, 2014
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.
butonic commentedon Oct 20, 2014
@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!
MorrisJobke commentedon Dec 2, 2014
Needs additional discussion in #11797
carlaschroder commentedon Jan 29, 2015
added to release notes
RobinMcCorkell commentedon Mar 20, 2015
Given that release notes have been updated, I'm marking this as a duplicate of #11797