Question
Raghuram Devarakonda · Mar 30, 2017

How to find the journal file that is being switched after Freeze?

Hi,

I am placing Cache instance in backup mode by using the command:

    csession <INST> -U%SYS "##Class(Backup.General).ExternalFreeze()"

and I see in the console log a message similar to follows:

"Journaling switched to: /cache/mgr/journal/20170330.002"

Now, is there a way to programmatically find out this journal file name? In fact, I am interested to find out the journal file that is switched. For example, in the above case, that would be "20170330.001".

Thanks,

Raghu

0
0 306
Discussion (4)3
Log in or sign up to continue

Try this

do ##class(%SYS.Journal.File).GetPrev("c:/cache/mgr/journal/20170330.002", prevFile)
write prevFile

There is one extra piece to this that you might want to look at, and that is the GetReason() classmethod of %SYS.Journal.File. It will tell you "by backup" if the file was switched by ExternalFreeze. The following code will search back from the current file and print out the file name of the journal file that was switched to for the most recent ExternalFreeze or Caché online backup (there is no error checking, so it could fail if you don't have any files created that way):

file = ##class(%SYS.Journal.System).GetCurrentFile()
reason = ""
{
reason = file.GetReason(file.Name)
q:reason="by backup"
##class(%SYS.Journal.File).GetPrev(file.Name,.name)
file = ##class(%SYS.Journal.File).%OpenId(name)
}
file.Name