3.1.7.31 Performing a Hash-Based Sync
A Hash-based Sync is performed after a Time-based Sync and any time that a connection is made after the first one (the first connection uses either Sync All or Time-based Sync).
The initiator of a Hash-based Sync MUST first sort its database and divide it into fixed-size Record Ranges. The primary sort MUST be by the record's Last Modification Time, and the secondary sort MUST be by the record ID. The size of each Record Range MUST be 10 Records. Each resulting Record Range can therefore be described by:
(ModificationTimeMIN, RecordIDMIN, ModificationTimeMAX, RecordIDMAX)
Any record satisfying the following conditions is in the given Record Range:
ModificationTime >= ModificationTimeMIN
ModificationTime <= ModificationTimeMIN
RecordID >= RecordIDMIN
RecordID <= RecordIDMAX
(ModificationTimeMIN, RecordIDMIN)is the lower boundary of the Record Range.
(ModificationTimeMAX, RecordIDMAX)is the upper boundary of the Record Range.
After the Record Ranges are determined, an MD5 hash MUST be generated for each Record Range. The data hashed for each Record Range are the Record IDs and Record Versions:
hash = MD5(RecordID1, RecordVersion1, RecordID2, RecordVersion2, ...)
After the hashes are generated, the initiator node MUST send (see section 3.1.7.1) a SOLICIT_HASH message:
The Inclusion Count MUST be 0x00.
The Exclusion Count MUST be 0x00.
The Hash Count MUST be nonzero.
The Hash Entry Array MUST contain a HASH_INFO_ENTRY for each Record Range.
Each HASH_INFO_ENTRY MUST contain the MD5 hash [RFC1321] for its Record Range as described above.
Each HASH_INFO_ENTRY MUST contain the upper boundary for its range as described above.