4.2 Change Order Handling Sequence

This example shows a change order handling sequence using three machines:

  • MA

  • MB

  • MC

The three machines are all members of a single replica set.

The replica tree root for each of the three machines is:

  • RA: C:\ReplicaRoot

  • RB: E:\Mydata\ReplicaRoot2

  • RC: H:\Public\Data

There are six connections linking the three machines:

  • CAB: Connection from MA to MB.

  • CBA: Connection from MB to MA.

  • CAC: Connection from MA to MC.

  • CCA: Connection from MC to MA.

  • CBC: Connection from MB to MC.

  • CCB: Connection from MC to MB.

The schedules on the six connections are all always on. In this example, it is assumed that all six connections have been established.

At time T1, a file F1 is created on MA. At time T2 (T2 – T1 = 2 seconds), a file F2 is created on MB. Both F1 and F2 have the same path and name relative to each of their replica tree roots:

  • F1: C:\ReplicaRoot\Hello.txt

  • F2: E:\MyData\ReplicaRoot2\Hello.txt

The size of F1 is eight bytes. The size of F2 is 10 bytes.

As F1 and F2 have the same name and path, each of the three machines has to resolve this as a file conflict. F2 is the winner on all three machines.

The change order handling sequence follows (the number indicates the sequence number; all the events happen after T2).

Change order handling sequence

Figure 4: Change order handling sequence

At time 1:

  • MA sends out the change order for F1 to MB through CAB. MA sends out the change order for F1 to MC through CAC.

At time 2:

When MC receives the change order for F1, MC checks its version vector and decides to accept this change order. At time 2, MC sends out CMD_SEND_STAGE to request the staging file for F1 through CAC.

At time 3:

When MA receives the CMD_SEND_STAGE from MC for F1on CAC, at time 3, MA sends out CMD_RECEIVING_STAGE to send the staging file for F1 to MC through CAC. As Hello.txt is small, one CMD_RECEIVING_STAGE sends out the entire staging file for F1.

At time 4:

When MC receives CMD_RECEIVING_STAGE for F1 (because the entire staging file is downloaded), MC does two things:

  • MC installs F1 and sends out CMD_REMOTE_CO_DONE to MA through CAC at time 4.

  • MC moves the change order for F1 from inbound log to outbound log. When the change order for F1 is in outbound log, MC sends the change order for F1 to all other machines, which is MB in this example. So, at time 4, MC sends out the change order for F1 to MB through CCB.

At time 5:

  • When MB receives the change order for F1 from MA on CAB, MB checks its version vector and decides to accept this change order. However, MB finds a name conflict with F2 on MB, and F2 is the winner. MB rejects the change order for F1 by sending out CMD_REMOTE_CO with flag CO_FLAG_ABORT_CO to MA through CAB at time 5.

  • When MB receives the change order for F1 from MC on CCB, MB checks its version vector and decides to accept this change order. However, MB finds a name conflict with F2 on MB, and F2 is the winner. MB rejects the change order for F1 by sending out CMD_REMOTE_CO with flag CO_FLAG_ABORT_CO to MC through CCB at time 5.

    • MB sends out the change order for F2 to MA through CBA.

    • MB sends out the change order for F2 to MC through CBC.

At time 6:

  • When MA receives the change order for F2 from MB on CBA, MA checks its version vector and decides to accept this change order. However, MB finds a name conflict with F1 on MA, and F2 is the winner. MA determines it needs to install this change order. At time 6, MA sends out CMD_SEND_STAGE to request the staging file for F2 through CBA.

  • When MC receives the change order for F2 from MB on CBC, MC checks its version vector and decides to accept this change order. However, MB finds a name conflict with F1 from MA, and F2 is the winner. MC determines it needs to install this change order. At time 6, MC sends out CMD_SEND_STAGE to request the staging file for F2 through CBC.

At time 7:

  • When MB receives the CMD_SEND_STAGE from MA for F2 on CBA, at time 7, MB sends out CMD_RECEIVING_STAGE to send the staging file for F2 to MA through CBA. As Hello.txt is small, one CMD_RECEIVING_STAGE sends out the entire staging file for F2.

  • When MC receives the CMD_SEND_STAGE from MB for F2 on CBC, at time 7, MB sends out CMD_RECEIVING_STAGE to send the staging file for F2 to MC through CBC. As Hello.txt is small, one CMD_RECEIVING_STAGE sends out the entire staging file for F2.

At time 8:

  • When MA receives CMD_RECEIVING_STAGE for F2, because the entire staging file is downloaded, MA does two things:

    • MA installs F2 and sends out CMD_REMOTE_CO_DONE to MB through CBA at time 8. Thus, F1 is overwritten by F2.

    • MA moves the change order for F2 from inbound log to outbound log. When the change order for F2 is in outbound log, MA sends the change order for F2 to all other machines, which is MC in this example. So, at time 8, MA sends out the change order for F2 to MC through CAC.

  • When MC receives CMD_RECEIVING_STAGE for F2, because the entire staging file is downloaded, MC does two things:

    • MC installs F2 and sends out CMD_REMOTE_CO_DONE to MB through CBA at time 8. Thus, F1 is overwritten by F2.

    • MC moves the change order for F2 from inbound log to outbound log. When the change order for F2 is in outbound log, MC sends the change order for F2 to all other machines, which is MA in this example. So, at time 8, MC sends out the change order for F2 to MA through CCA.

At time 9:

When MA receives the change order for F2 from MC, MA checks its version vector and decides to dampen this change order because this change order for F2 is readily known. At time 9, MA sends out CMD_REMOTE_CO_DONE with flag CO_FLAG_ABORT_CO to MC through CCA.

At time 10:

When MC receives the change order for F2 from MA, MC checks its version vector and decides to dampen this change order because this change order for F2 is readily known. At time 10, MC sends out CMD_REMOTE_CO_DONE with flag CO_FLAG_ABORT_CO to MA through CAC.