ALGORITHM 4.
Steps for roll-back triggered by a RB-message
| Input: Roll-back time rbt, the RB-message rb |
| Output: the number of events recovered to LPEQ nRecovered |
| Search the latest valid state s prior to rbt with timestamp t1; |
| Recover LVT of this LP to t1, recover state to s; |
| nRecovered = 0; |
| for channel ch in input channel list do |
| if ch == rb.channel then |
| Remove all ordinary events with send time greater than or equal to rb.st in ch.ICEQ, |
| ch.ICPQ, LPEQ and TEQ; |
| Recover events with receive time greater than t1 to ch.ICEQ from ch.ICPQ; |
| if ch.submit.st ≥ rb.st & ch.ICEQ is not empty then |
| Submit the smallest event in ch.ICEQ to LPEQ and update ch.submit; |
| nRecovered++; |
| end |
| else |
| Recover events with receive time greater than t1 to ch.ICEQ from ch.ICPQ; |
| end |
| if ch.ICEQ.head.rt < submit.rt then |
| Submit the smallest event in ch.ICEQ to LPEQ and update ch.submit; |
| nRecovered++; |
| end |
| if ch.scheduleHistory ≥ LVT then |
| Send a RB-message (RB_PRIORITY, LVT) to ch.neighbour; |
| Set ch.scheduleHistory to LVT; |
| end |
| end |