Partition Index, Modulus, and Creation Window

When instances of a partitioned class are created, the file partition in which an instance is stored is determined by a zero-relative index referred to as the partition index.

A user-defined partition modulus (m) associated with a partitioned file defines a window of the m latest partitions in which new instances are stored. The latest partition of a modulus is referred to as the creation window, since it defines the window (a subset) of partitions where new objects are created. The partition modulus is an attribute of a partitioned file, with a value in the range 1 through 1,024. Each partitioned file can have a different value, to allow the partitioning schemes to vary.

The partition index value of zero (0) always refers to the latest partition created, partition 1 to the second-latest, and so on up to the limit of partition index m-1. The latest partition is also referred to as the current partition. Whenever a new partition is added to the file, the creation window slides up by one, so that partition index zero (0) corresponds to the newly created partition and the prior partition with index modulus - 1 drops out of the window.

The partition index concept allows partitioning algorithms to allocate new objects within a bounded subset of partitions. The algorithm can assume a fixed number of partitions and need not consider historical partitions.

The following diagram shows a partitioning scheme where the creation window has a modulus of five (5). New objects are stored in the five latest partitions and the valid range of partition index values is zero through four (0 - 4).

In this diagram, partition index zero (0) maps to the latest partition, which in this case is 100. If a new partition were to be created, the new partition would be assigned partition identifier 101 and partition index zero (0) would then correspond to partition identifier 101, as that is now the latest.

To implement a standard sliding window strategy in which a new partition is created periodically (for example, daily, weekly, or monthly), leave the modulus set to the default value of 1 and set the partition index to zero (0) for creates. This will cause objects to be created in the latest partition, by default. The partition with index value zero (0) is used unless you re-implement the autoPartitionIndex method or call the setPartitionIndex method.