Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

We have the RemoteClusterUtils API to enable users to perform some operations of their MirrorMaker environment. One method, translateOffsets(), allows to manually translate consumer group offsets. This is useful when MirrorCheckpointConnector is not configured to automatically sync offsets or when dealing with a disaster and unplanned failover. This method works by fully reading the checkpoints topic which is populated by MirrorCheckpointConnector, so this can be an expensive call and it can take a long time if depending on the size of the topic is large. This method takes a single consumer group id as input, so it makes it unsuitable in cases when the offsets of several consumer groups have to be translated as each call re-reads the full topic.

Since the full topic is read anyway, we should have a method to translate the committed offsets of multiple consumer groups at a the same time.

Public Interfaces

A new translateOffsets() method in RemoteClusterUtils, that takes a set of consumer group Ids:

Code Block
languagejava
/**
 * Translates remote consumer groups' offsets into corresponding local offsets. Topics are automatically
 *  renamed according to the configured {@link ReplicationPolicy}.
 *  @param properties Map of properties to instantiate a {@link MirrorClient}
 *  @param remoteClusterAlias The alias of the remote cluster
 *  @param consumerGroupIds The listset of consumer group Ids
 *  @param timeout The maximum time to block when consuming from the checkpoints topic
 */
public static Map<String, Map<TopicPartition, OffsetAndMetadata>> translateOffsets(Map<String, Object> properties, String remoteClusterAlias, Set<String> consumerGroupIds, Duration timeout) {
}

...

Code Block
languagejava
/**
 * Translates remote consumer groups' offsets into corresponding local offsets. Topics are automatically
 * renamed according to the ReplicationPolicy.
 * @param consumerGroupIds The listset of consumer group Ids
 * @param remoteClusterAlias The alias of remote cluster
 * @param timeout The maximum time to block when consuming from the checkpoints topic
 */
public Map<String, Map<TopicPartition, OffsetAndMetadata>> remoteConsumerOffsets(Set<String> consumerGroupIds, String remoteClusterAlias, Duration timeout) {
}

...