private void movePartition(TopicPartition partition, String oldConsumer, String newConsumer) {
            ConsumerPair pair = new ConsumerPair(oldConsumer, newConsumer);

            if (partitionMovements.containsKey(partition)) {
                // this partition has previously moved
                ConsumerPair existingPair = removeMovementRecordOfPartition(partition);
                assert existingPair.dstMemberId.equals(oldConsumer);
                if (!existingPair.srcMemberId.equals(newConsumer)) {
                    // the partition is not moving back to its previous consumer
                    // return new ConsumerPair2(existingPair.src, newConsumer);
                    addPartitionMovementRecord(partition, new ConsumerPair(existingPair.srcMemberId, newConsumer));
                }
            } else
                addPartitionMovementRecord(partition, pair);
        }
This class maintains some data structures to simplify lookup of partition movements among consumers. At each point of
time during a partition rebalance it keeps track of partition movements corresponding to each topic, and also possible
movement (in form a <code>ConsumerPair</code> object) for each partition.
clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractStickyAssignor.java