core icon indicating copy to clipboard operation
core copied to clipboard

Swift Backend Mapping URN:OID to original file names

Open razyr opened this issue 11 years ago • 11 comments

OwnCloud 8.0.4 with Swift object storage on the back end.

We had a hiccup on Friday with our upstream provider's Swift environment. Since then OwnCloud is spitting several thousand errors similar to the following

ownCloud[8165]: {objectstore} Could not get object: urn:oid:10641 could not be found.

I've done a "swift list" on the container and dumped the output to a text file. I can confirm that all of the urn:oid:xxxx errors are consistent in that there are no such files.

We have just over 5,000 files in Swift, which I believe would be consistent with the number of files our customer is storing on their OwnCloud server.

We also have 2,000+ errors showing mismatched/missing URNs.

Where does the mapping live between the URN and original file/path name? I've looked in the OwnCloud database, but if it's there, it's well disguised. I thought oc_file_map might be an obvious place, but that table is empty.

Is there any way to check the consistency and/or repair this data?

razyr avatar Jun 24 '15 15:06 razyr

@butonic Any idea?

LukasReschke avatar Jun 24 '15 15:06 LukasReschke

the URN consists of urn:<NID>:<NID specific part>, eg. urn:isbn:3827370191 In this case the namespace is the object id or oid. Since we are talking about file objects the NID specific part is the fileid, eg urn:oid:10641.

All entries in the filecache table should have a matching object in the objectstore: fileid column in filecache -> oid in urn:oid:<oid>.

The reason is that with this no trip to the objectstore is necessary for stat, rename and move operations.

It seems that your provider either lost some objects or the connection is only working sporadically. Currently, there is no automatic check that removes entries from the filecache that are no longer in the objectstore.

Does that clear it up?

butonic avatar Jun 24 '15 15:06 butonic

Thanks @butonic. That does help a lot. Data was lost by the provider and I'm now able to document what/how much.

razyr avatar Jun 24 '15 16:06 razyr

Assuming that the lost data is non-recoverable, I'd like to run a recovery plan past you for a sanity check.

There should be a copy of all of the lost data in local /Owncloud folders. They are running the Windows desktop client on all machines.

  • [ ] Stop local clients
  • [ ] Copy everything out of the OwnCloud local folder.
  • [ ] Delete the contents of the following tables:
    • [ ] oc_filecache
    • [ ] files_trash
    • [ ] oc_share
    • [ ] oc_share_external
  • [ ] Copy the files back into local /Owncloud folder
  • [ ] Recreate the internal/staff shares
  • [ ] Steal underpants
  • [ ] ???
  • [ ] Profit

razyr avatar Jun 24 '15 17:06 razyr

@razyr If you can live with loosing all shares, then yes, this order makes sense. Regarding the client maybe @dragotin can point out a solution that does not involve copying files. Maybe remove and reestablish the oc server connection configuration?

If no other apps are used, this might be an opportunity to update to the latest OC release as well.

hope this helps.

Just to note it down somewhere. I was thinking how oc could better deal with this kind of problems. When oc assumes exclusive ownership of a storage we can detect these problems whenever a file is accessed. Maybe automatically ask if the client has the file and have him reupload it (technically it would require writing a list of missing files, but it would be useable with all storage backends)? Sounds a little bit like the CRC check for uploads. In this case the file is missing after an unknown time period. @dragotin @DeepDiver1975 opinions?

butonic avatar Jun 25 '15 08:06 butonic

Maybe automatically ask if the client has the file and have him reupload it (technically it would require writing a list of missing files, but it would be useable with all storage backends)?

This is totally against our main design principle of the sync algo. Furthermore how should the server ask the clients? In addition which clients? All?

DeepDiver1975 avatar Jun 25 '15 10:06 DeepDiver1975

I am just thinking out loud here, trying to come up with a solution that expects failure. I am aware of the sync algorithm. However, there is always room for improvement. As you know the client does a PROPFIND every 30seconds. We could send the client a 410 Gone status ... technically it shoud be a 5xx error, but in this case we want the client to reupload the file, so a 4xx tells him to act. And to answer your last question. Of course every client. And even an oc instance that holds a cached version of a file shared via s2s (which still needs to be implemented). Now have :beer: and relax.

butonic avatar Jun 25 '15 11:06 butonic

Now have :beer: and relax.

once we have 8.1 shipped and the team has time to breath - yes

DeepDiver1975 avatar Jun 25 '15 12:06 DeepDiver1975

@butonic Is this related to #17147?

MorrisJobke avatar Jan 06 '16 07:01 MorrisJobke

@MorrisJobke no, the discussion moved to an idea of how to detect and repair data loss on the server side ... but I think this can be closet. Either the server can rely on the storage or everything is broken. Not a problem we should focus on now.

butonic avatar Jan 06 '16 08:01 butonic

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.

lock[bot] avatar Aug 07 '19 03:08 lock[bot]