Lorenzo Scalese · May 6, 2021

Install ZMIRROR Routine


Question about ZMIRROR routine.

I analyze a problem with the label NotifyBecomePrimary. It seems not performed after a switch.

After installing ZMIRROR routine in %SYS, is a restart required?
If It's required, It could be explain my problem.

Thank you.

Product version: HealthShare 2018.1
0 229
Discussion (4)2
Log in or sign up to continue

Finally, It was simple.
The routine has been installed after the switch, but before my investigation.
So, I thought the routine was there and not performed.

@Lorenzo Scalese 
How did you configure/install ZMIRROR? Where does it need to be put for the system to recognize it needs to run? I understand what ZMIRROR does, just looking for examples.

Hi @Scott Roth ,

The routine ZMIRROR.MAC must be installed in the namespace "%SYS" on each failover member.  It needs the IRISLIB database mounted in RW for installation.

I use ZMIRROR.MAC to execute code when a node becomes primary, in my example I just implement "NotifyBecomePrimary" label :

    Try {
        Set ns = "MYAPPNAMESPACE"
        If ##class(Config.Namespaces).Exists(ns) {
            JOB ##class(pkg.Class).ClassMethod():(ns):2
    } Catch(ex) { } ; just a security
    Quit:$Quit 1

There are many events available, we can see the list on this documentation page .
What event mirror are you interested in?

Thanks this gives me some guidance along with other examples I have gotten. NotifyBecomesPrimary is the one I’m most looking at right now. Once that hits then I’m going to call a shell script through $ZF to execute.