2.5 Selecting Changes with Digest
SData uses two passes to synchronize two nodes Nj and Nk: one pass to propagate Nj's changes to Nk and a second pass in the other direction to propagate Nk's changes to Nj.
The following table describes how the algorithm selects resources from N1 when synchronizing from N1 to N2, and then how it selects resources from N2 when synchronizing in the other direction.
|
Direction |
Node |
Digest Before |
DigestAfter |
Select clause |
Comments |
|---|---|---|---|---|---|
|
N1->N2 |
N1 |
(N1 6 1) |
(N1 6 1) |
SELECT * FROM N1.K WHERE |
The selection criteria only takes into account the pairs that have a higher
tick on N1. |
|
N2 |
(N1 5 1) |
(N1 6 1) |
|||
|
N2->N1 |
N1 |
(N1 6 1) |
(N1 6 1) |
SELECT * FROM N2.K WHERE |
Same as above, reversing the roles of N1 and N2. The digests are equal at the end of the operation. |
|
N2 |
(N1 6 1) |
(N1 6 1) |
The interval tests can be reduced to simple inequality tests. For example, instead of testing for tick in [5, 6[, we could simply test for tick >= 5. The second form is more practical when the resource ticks are incremented at the time the sync pass is run rather than at the time the resource is modified (see Tick Management section) because, in this case, the upper bound of the tick is not know until we have scanned all modified resources.
At the end of the bidirectional synchronization, the digests are identical on N1 and N2. Of course, this is only true if resources are not modified concurrently with the synchronization passes.
SData Synchronization - version 1.1
