You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Federico Valeri (Jira)" <ji...@apache.org> on 2024/09/05 08:54:00 UTC

[jira] [Commented] (KAFKA-17428) Remote segments stay in COPY_SEGMENT_STARTED state after RLMCopyTask fails to upload

    [ https://issues.apache.org/jira/browse/KAFKA-17428?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17879490#comment-17879490 ] 

Federico Valeri commented on KAFKA-17428:
-----------------------------------------

Hi [~showuon], thanks for our discussion. Please correct me if I there is something wrong in my notes.

As you pointed out, we may not need an additional state, so no KIP required. After the segment copy fails, we try to delete the remote data directly, without changing the segment state to DELETE_SEGMENT_STARTED. This is a problem because we never try again, and dangling data may accumulate in the remote storage. The solution is to use RemoteLogManager.deleteRemoteLogSegment, which would set the correct segment state. Then, we also need to change RemoteLogManager.RLMExpirationTask.RemoteLogRetentionHandler.buildRetentionSizeData in order to include DELETE_SEGMENT_STARTED state. These two changes would periodically trigger the deletion of dangling segments in RLMExpirationTask.RemoteLogRetentionHandler.cleanupExpiredRemoteLogSegments, which is driven by retention settings and log-start-offset changes. 

> Remote segments stay in COPY_SEGMENT_STARTED state after RLMCopyTask fails to upload
> ------------------------------------------------------------------------------------
>
>                 Key: KAFKA-17428
>                 URL: https://issues.apache.org/jira/browse/KAFKA-17428
>             Project: Kafka
>          Issue Type: Improvement
>            Reporter: Luke Chen
>            Assignee: Federico Valeri
>            Priority: Major
>              Labels: kip-required
>
> Currently, we will delete failed uploaded segment and Custom metadata size exceeded segments in copyLogSegment in RLMCopyTask. But after deletion, these segment states are still in COPY_SEGMENT_STARTED. That "might" cause unexpected issues in the future. We'd better to move the state from {{COPY_SEGMENT_STARTED}} -> {{DELETE_SEGMENT_STARTED}} -> {{DELETE_SEGMENT_FINISHED}}
>  
> updated:
> I thought about this when I first had a look at it and one thing that bothered me is that {{DELETE_SEGMENT_STARTED}} means to me that we're now in a state where we attempt deletion. However if the remote store is down and we fail to copy and delete we will leave that segment in {{DELETE_SEGMENT_STARTED}} and not attempt to delete it till the segment itself breaches retention.ms/bytes.
> We can probably just make it clearer but that was my thought at the time.
> So, maybe when in deletion loop, we can add {{DELETE_SEGMENT_STARTED}} segments into deletion directly, but that also needs to consider the retention size calculation.
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)