public CoordinatorResult<Void, CoordinatorRecord> classicGroupSync(
        RequestContext context,
        SyncGroupRequestData request,
        CompletableFuture<SyncGroupResponseData> responseFuture
    ) throws UnknownMemberIdException {
        Group group;
        try {
            group = group(request.groupId());
        } catch (GroupIdNotFoundException e) {
            responseFuture.complete(new SyncGroupResponseData()
                .setErrorCode(Errors.UNKNOWN_MEMBER_ID.code()));
            return EMPTY_RESULT;
        }

        if (group.isEmpty()) {
            responseFuture.complete(new SyncGroupResponseData()
                .setErrorCode(Errors.UNKNOWN_MEMBER_ID.code()));
            return EMPTY_RESULT;
        }

        if (group.type() == CLASSIC) {
            return classicGroupSyncToClassicGroup((ClassicGroup) group, context, request, responseFuture);
        } else {
            return classicGroupSyncToConsumerGroup((ConsumerGroup) group, context, request, responseFuture);
        }
    }
Handle a SyncGroupRequest.

@param context        The request context.
@param request        The actual SyncGroup request.
@param responseFuture The sync group response future.

@return The result that contains records to append.
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupMetadataManager.java