core icon indicating copy to clipboard operation
core copied to clipboard

[6.0.3] Files uploaded directly to SWIFT storage don't show up in oC

Open ser72 opened this issue 12 years ago • 38 comments

Steps

  1. configure External Storage as SWIFT
  2. Upload a file directly to the SWIFT storage -- not through oC
  3. View SWIFT directory in oC and the file from Step 2 isn't there:

IMAGES Swift storage -- the last file is uploaded directly to SWIFT. The other 2 were uploaded via oC.

bouquet_contents_missing_file

oC. Notice the missing file capture

ser72 avatar May 19 '14 12:05 ser72

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 avatar May 19 '14 12:05 PVince81

CC @icewind1991

PVince81 avatar May 19 '14 12:05 PVince81

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

icewind1991 avatar May 19 '14 13:05 icewind1991

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 avatar May 19 '14 13:05 PVince81

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 avatar May 19 '14 15:05 PVince81

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 avatar May 19 '14 15:05 PVince81

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 avatar May 19 '14 15:05 PVince81

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.

PVince81 avatar May 19 '14 16:05 PVince81

@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.

ser72 avatar May 22 '14 11:05 ser72

@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 avatar May 22 '14 12:05 PVince81

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:

file_in_root.txt
subdir/
subdir/file_in_subdir.txt

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 avatar May 22 '14 13:05 PVince81

@icewind1991 would it be possible to trigger a rescan specifically for a given storage using a cron job ?

PVince81 avatar May 22 '14 13:05 PVince81

Not possible at the moment, would be fairly easy to write an app for it

icewind1991 avatar May 22 '14 15:05 icewind1991

@PVince81

Any updates on this issue?

ser72 avatar May 27 '14 13:05 ser72

The only possibility I see for now is to poll the server for changes (bad performance), trigger a rescan regularly. But as @icewind1991 pointed out it seems it's not possible. Currently triggering a rescan, I believe, will rescan all storages, not only the SWIFT one.

I need support from @icewind1991 for the rescan/cron job part.

PVince81 avatar May 27 '14 13:05 PVince81

@ser72 I guess you already tried running ./occ files:scan and the updates were still not there ? Maybe we can add an option to force a full rescan, so the admin can create a system cron job to run that command (as a quick fix)

PVince81 avatar May 27 '14 14:05 PVince81

@PVince81 Don't recall, off hand, if we did that. Just requested it be done and will let you know the results.

ser72 avatar May 30 '14 11:05 ser72

@PVince81 Did the file scan and the updates were still not there...

ser72 avatar May 30 '14 11:05 ser72

Actually it should be ./occ files:scan --all. I discovered today that if you don't pass arguments, there is no output at all, but also nothing happens.

But based on what I found out today about etag propagation, there is only a minor chance that this works.

PVince81 avatar May 30 '14 12:05 PVince81

./occ files:scan --all made the files visible.

Need to cron that as a work around

ser72 avatar Jun 02 '14 12:06 ser72