Question
Eduard Lebedyuk · Aug 12

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
0
0 109
Discussion (2)1
Log in or sign up to continue

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" }
  //   }
}