Closed simont closed 8 years ago
Once again, thanks for the bug report and the extra effort to trace down the cause. I just committed a temporary fix, but I need to go back and add better error handling i.e. differentiate between errors and empty meta collections.
Thanks John, I can confirm that I can now create new metadata for objects that had no preexisting metadata associated with them.
S.
Not quite sure why but this is happening again, but only for dataObjects. If I have a line as follows
mc, err := theThing.Meta()
If theThing is a new collection then err == nil and a subsequent theThing.AddMeta() succeeds, if theThing is a brand new dataObject then err != nil and theThing.AddMeta() fails with the following error:
FATAL: 2016-07-19 20:55:30.138266861 +0000 UTC: Fatal - iRods Get Meta Failed: /tempZone/home/alice/NGSData, None, -1
It looks like a new Collection with no existing MetaCollection is getting initialized correctly whereas a similar dataObject is not.
See if this fixes things: https://github.com/jjacquay712/GoRods/commit/309fd42f279f14a32b98d6fca92aa7a4bca41894
That seems to do the trick, thanks!
If an object has no existing metadata associated with it then it appears that the object's MetaCollection is nil. If you try to add a new metadata triple then this fails because the MetaCollection is nil and there doesn't appear to be a way to initialize an empty meta collection in order to add new metadata to it.
The error message I'm seeing is:
Problem creating metadata: 2016-07-13 19:46:34.394670434 +0000 UTC: Fatal - iRods Get Meta Failed: 0x7fbfcc09cc70, None
It looks like its coming from MetaCollection.ReadMeta() at 166 (and would also come from 173 for Collections)
https://github.com/jjacquay712/GoRods/blob/master/meta.go#L149
I suspect its being thrown because the code goes all the way down to iRODS to find metadata but then still comes up empty and there isn't anything in place to handle that case and instantiate an appropriate empty MetaCollection that we can then populate going forward.
S.