3.1.5.5 Creating Compact IDSET Structures

As the number of changes that happen to a folder grows over time, the sets of Message ID ([MS-OXCDATA] section 2.2.1.2) and CN structures, as specified in section 2.2.2.1, that are kept in an IDSET structure, as specified in section 2.2.2.4, grow as well. The size of the IDSET is rarely a problem for hierarchy synchronization operations due to the small number of folders commonly present in mailboxes. Therefore, this discussion focuses on content synchronization operations. In this section, the term IDSET is used to refer to both IDSET and CNSET structures.

The following mechanisms are available to help optimize IDSET structures for performance:

  1. IDSET compression: The wire format of IDSET structures is optimized for consecutive ranges and sets of nonconsecutive IDs that have close values.

  2. Clustering of IDs: Clients and servers SHOULD allocate IDs of messages within a folder from contiguous sets of IDs. This optimization is based on an assumption that with time, all old messages are either deleted or moved to another folder, and so all of their IDs could be represented as one range. For more details, see section 3.3.5.2.1.

  3. Collapsing of ranges: If an IDSET structure is never iterated over and is only used in operations like "not in", it is possible to add ranges of IDs to the IDSET structure to help collapse its regions, if that would not affect the results of operations it is used in.

    Note that because the synchronization scope limits synchronization to one folder, and the algorithm for determining the difference between replicas (1), as specified in section 3.2.5.3, only checks that a certain ID is not in the MetaTagCnset * properties, it is possible to add CN structures that were either never used or used on objects outside the synchronization scope to these IDSET structures without affecting the outcome. Note that this MUST NOT be done for IDSET structures that are ever iterated over, such as the MetaTagIdsetGiven property (section 2.2.1.1.1), as it will change the outcome.

    For example, an IDSET structure contains [10; 20] and [30; 40] for some REPLGUID. Because every internal change number within the same REPLGUID structure MUST be greater than any previous one, and the change numbers [21; 29] do not belong to any messages in the current folder, the two regions can be safely collapsed into [10; 40].