errDbNotFound in ForEachMFSFile loop
I'm developing a client/server app that will keep track of all the movies that are showing on TiVo and allow you to filter out those that you don't want to see, and then you'll never have to deal with them again. I've got it working, but sometimes (not all the time) when running the server side (TiVo) TCL script, some, but not all of the /Schedule subelements will fail on the [db $db openid $fsid] with an errDbNotFound. What makes it particularly frustrating is that the same fsid won't fail the next time I run it.
I've looked in mfslib.tcl and think I understand both RetryTransaction and ForEachMFSFile and don't see where there is a problem there (BTW, I modified (after all the problems started) ForEachMFSFile to accept a continue retured from body. Any idea why this wasn't included, since it is included in RetryTransaction). I haven't been able to find the source or include files for the mfs command to get any better information on when errDbNotFound is returned. I looked at lots of threads with that error in them, but no one every seemed to explain it (and it several cases it seemed to just go away, as mine has from time to time).
Anyway, I'd really like to understand what is causing this, as it will cause me to miss movies when it occurs. Any tips would be greatly appreciated.
ForEachMFSFile is sometimes a bit flaky about state. For instance, IIRC, you can't use it recursively. Have you tried using ForEachMFSFile to build a list of fsids/paths/whatever, and then iterating over that list after you are out of the ForEachMFSFile loop?
It does appear to be something involved with the state. For those who don't know, ForeachMfsFile gets 50 records at a time, processes those, then goes and gets another block of 50. What I found was that if a record got the errDbNotFound (and I'm still not sure what causes that) the rest of the records in that block would get it as well, but if I went back and got 50 "new" records, starting with the one that failed, everything worked fine. So I just created my own version of ForeachMfsFile which allows me to do that, and everything now works.
I would like to know what causes the errDbNotFound error. I think it may be related to the errTmBackgroundHoldoff, since I seemed to get that after I got a set of the errDbNotFounds. Is there any documentation on what the various err's are? I know the names seem descriptive, but I think there may be a deeper meaning.
Anyway, this is what has worked for me. Hope it saves someone else some time.