com.continuent.tungsten.replicator.storage.parallel
Interface Partitioner

All Known Subinterfaces:
StatefulPartitioner
All Known Implementing Classes:
HashPartitioner, LoadBalancingPartitioner, RoundRobinPartitioner, ShardListPartitioner, SimplePartitioner

public interface Partitioner

Implements an algorithm to divide replicator events into partitions. This is used to support channel assignment in parallel apply. The partitioning algorithm must be idempotent and must result in the same channel assignment for a specific shard. The algorithm may change only after a clean shutdown, i.e., following an offline operation.

Channels were called "partitions" in the original parallel apply implementation. The terms partition and channel are equivalent in the code. Only channel should be used for user-visible interfaces, configuration files, and documentation.

Version:
1.0
Author:
Robert Hodges

Method Summary
 PartitionerResponse partition(ReplDBMSHeader event, int taskId)
          Assign an event to a particular partition.
 void setContext(PluginContext context)
          Assigns the current runtime context in case the partitioner needs to refer to replicator state.
 void setPartitions(int availablePartitions)
          Sets the number of available partitions.
 

Method Detail

setPartitions

void setPartitions(int availablePartitions)
Sets the number of available partitions.

Parameters:
availablePartitions - Number of partitions available

setContext

void setContext(PluginContext context)
Assigns the current runtime context in case the partitioner needs to refer to replicator state.

Parameters:
context - Replicator runtime context

partition

PartitionerResponse partition(ReplDBMSHeader event,
                              int taskId)
                              throws ReplicatorException
Assign an event to a particular partition. All fragments of a particular sequence number must go to the same partition.

Parameters:
event - Event to be assigned a partition
taskId - Task id of input thread
Returns:
Response containing partition ID and whether event requires a critical section
Throws:
ReplicatorException