Written by

Senior Cloud Architect at InterSystems
MOD
Question Eduard Lebedyuk · Aug 12, 2022

Code to detect that mirror backup is caught up

How do I detect that sync mirror backup is caught up to primary? Or at least close to caught up.

I'm executing the code on a backup.

Product version: IRIS 2021.2

Comments

Yaron Munz · Aug 15, 2022

get the mirror name:

ZN "%sys"
Set mirrorName=$system.Mirror.GetMirrorNames()
Set result = ##class(%ResultSet).%New("SYS.Mirror:MemberStatusList")
Set sc = result.Execute(mirrorName)
while result.Next() {
   Set transfer=result.GetData(6)
   // you may filer the check for a specific machine on GetData(1)
   // Do any check on "transfer" to see if behind and calculate the threshold time e.g.
  // For i=1:1:$l(transfer," ") {  
  //    If $f($p(transfer," ",i),"hour") { W !,"hour(s) behind" }
  //      Elseif $f($p(transfer," ",i),"minute") { Set minutes=$p(transfer," ",i-1) W !,minutes_" minutes behind" }
  //   }
}

0
Eduard Lebedyuk  Aug 15, 2022 to Yaron Munz

Thank you. Looks like what I need.

0