void handleSegmentWithDeleteSegmentStartedState(Long startOffset, RemoteLogSegmentId remoteLogSegmentId) {
        // Remove the offset mappings as this segment is getting deleted.
        offsetToId.remove(startOffset, remoteLogSegmentId);

        // Add this entry to unreferenced set for the leader epoch as it is being deleted.
        // This allows any retries of deletion as these are returned from listAllSegments and listSegments(leaderEpoch).
        unreferencedSegmentIds.add(remoteLogSegmentId);
    }
@Test
    void handleSegmentWithDeleteSegmentStartedState() {
        RemoteLogSegmentId segmentId1 = new RemoteLogSegmentId(tpId, Uuid.randomUuid());
        RemoteLogSegmentId segmentId2 = new RemoteLogSegmentId(tpId, Uuid.randomUuid());
        epochState.handleSegmentWithCopySegmentFinishedState(10L, segmentId1, 100L);
        epochState.handleSegmentWithCopySegmentFinishedState(101L, segmentId2, 200L);
        assertEquals(2, epochState.referencedSegmentIds().size());

        epochState.handleSegmentWithDeleteSegmentStartedState(10L, segmentId1);
        epochState.handleSegmentWithDeleteSegmentStartedState(101L, segmentId2);
        assertTrue(epochState.referencedSegmentIds().isEmpty());
        assertEquals(2, epochState.unreferencedSegmentIds().size());
        assertTrue(epochState.unreferencedSegmentIds().containsAll(Arrays.asList(segmentId1, segmentId2)));
    }