private ShareGroupMember maybeReconcile(
        String groupId,
        ShareGroupMember member,
        int targetAssignmentEpoch,
        Assignment targetAssignment,
        List<CoordinatorRecord> records
    ) {
        if (member.isReconciledTo(targetAssignmentEpoch)) {
            return member;
        }

        ShareGroupMember updatedMember = new ShareGroupAssignmentBuilder(member)
            .withTargetAssignment(targetAssignmentEpoch, targetAssignment)
            .build();

        if (!updatedMember.equals(member)) {
            records.add(newCurrentAssignmentRecord(groupId, updatedMember));

            log.info("[GroupId {}] Member {} new assignment state: epoch={}, previousEpoch={}, state={}, "
                    + "assignedPartitions={}.",
                groupId, updatedMember.memberId(), updatedMember.memberEpoch(), updatedMember.previousMemberEpoch(), updatedMember.state(),
                assignmentToString(updatedMember.assignedPartitions()));
        }

        return updatedMember;
    }
Reconciles the current assignment of the member towards the target assignment if needed.

@param groupId               The group id.
@param member                The member to reconcile.
@param targetAssignmentEpoch The target assignment epoch.
@param targetAssignment      The target assignment.
@param records               The list to accumulate any new records.
@return The received member if no changes have been made; or a new
        member containing the new assignment.
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupMetadataManager.java