Vladimir, the question was to resume the iteration from given point. Say we have only two indexes, A and B. When resuming, the code first has to check next values of B and only then next values of A. Your code stars with A skipping all remaining values of B.

Check $query-based solution in my answer to a post below. Looks to me as more elegant than with nested loops.

My reworked solution so far. Looks working on samples I tested

    ; Get log for given 'clientid'
    ; 'maxlog' records max, starting from given 'date','dek','idx'
GetXLog(clientid,date,dek,idx,maxlog) public
{
    s:maxlog="" maxlog=400
    s counter=0
    s gl=$name(^cxlog(clientid,date,dek,idx)) ; ^cxlog("EFRW1000",20161219,2,1,"date")=20161219

    for { q:counter=maxlog
        s oldroot=$name(@gl,4)  ; we care only about first 4 indexes
        s gl=$query(@gl)    ; take next global
        s root=$name(@gl,4)
        continue:oldroot=root ; skip all sub-globals        

        q:clientid'=$qsubscript(root,1) ; for given 'clientid' only

        w root,!
        s counter=counter+1
    }

    w !
}

John,

  • There were no changes neither to ns configuration nor to db configuration.
  • Looks like ns gets its twin as soon as updated routines are imported into this namespace.
  • The issue happens on production db only, we can't repeat it on test databases of same version.

If I see your explanations right, the issue is just a harmless result of some internal Cache's behaviour, so I should not really care, right?