How to resync ^ROUTINE and ^rINDEX?
I have a few routines in ^rINDEX that are missing in ^ROUTINE. At least some of those routines lack a timestamp, probably Date and Time Modified in ^rINDEX. It causes D %RO crash when such a routine is referenced by a routine range, since "" is an illegal $ZDTH value.
Healthy entry (note the timestamp): ^rINDEX("ABC,"INT") = $lb("2021-06-15 15:08:38.846885",) ;The second argument is sometimes present and sometimes not, likely the routine size.
Unhealthy entry (note an empty timestamp): ^rINDEX("DEF,"INT") = $lb("",21)
Finally, a question, not only for this situation. Is there an official, or a recommended way to rebuild rINDEX, maybe ^ROUTINE too. rINDEX has quite a few various purpose nodes, so it's probably not as straightforward as creating or deleting its nodes above based on ^ROUTINE entries.
Have you had a look at %RoutineIndex::RebuildIndex? The documentation suggests this does what you want: https://docs.intersystems.com/irisforhealthlatest/csp/documatic/%25CSP.D.... It should be available in the version of Ensemble you're running.
I made a mistake, now corrected: it's Cache, not Ensemble. It does have this function too. I'll post results here.
I rebuild ^rINDEX using, as recommended, D ##class(%Library.RoutineIndex).RebuildIndex($NAMESPACE). That reduced the number of ^rINDEX entries with an empty Date Modified, the cause of the $RO error. However, this function is partially based on ^ROUTINE which in its turn had bogus entries, all of the type ^ROUTINE("ABC",0,"SIZE")=<some integer>. That’s all these routines contain. I killed these ^ROUTINE nodes and rebuilt ^rINDEX. No empty Date Modified.