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

周沛辰 commented on IOTDB-5093:
----------------------------

*跨空间选文件流程:* # 
从TsFileManager里获取seqFiles和unseqFiles

 # 
过滤掉被删除的顺序文件和被删除、isCompacting、isCandidate的乱序文件,放入CandidateList

 # 
从CandidateList里选择有重叠的顺乱序文件,每选一个乱序文件,就检查其顺序文件是否有效(若isCompacting、isCandidate、isDeleted则无效),若否则返回

*Bug产生:*
!image-2022-12-02-21-29-16-925.png|width=853,height=205!
文件3 4正在被其他线程合并,接着来了跨空间选文件,选文件流程: # 
获取的seqFiles里有1 2 3 4 5。(接着其他合并线程对文件3'与3 4进行内存置换,然后 3 4 被置为deleted并删除了)

 # 
第二步的时候就会过滤掉 3 4,将 1 2 5放入CandidateList里

 # 
从CandidateList里进行选文件,选中1 2 5 6,导致合出来的目标文件与其他文件有重叠

*解决方法:* # 
获取 1 2 3 4 5

 # 
不对顺序文件进行过滤,因此顺序CandidateList里有1 2 3 4 5

 # 
选文件发现3 4 正在被其他合并占用或者被删除 丢弃文件

> Fix compaction selector bug
> ---------------------------
>
>                 Key: IOTDB-5093
>                 URL: https://issues.apache.org/jira/browse/IOTDB-5093
>             Project: Apache IoTDB
>          Issue Type: Bug
>    Affects Versions: master branch, 0.13.0-SNAPSHOT
>            Reporter: 周沛辰
>            Assignee: 周沛辰
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.0.0
>
>         Attachments: image-2022-12-02-21-29-16-925.png
>
>
> *Description*
> target file overlap with previous file 
>  
> *Reason*
> In the process of getting the file list and starting to select files, the 
> file list is updated (the file is deleted or the status is updated). When a 
> seq file is occupied and deleted by other compaction thread, and it happens 
> to select files in cross space compaction, the deleted file will be filtered 
> out, resulting in an overlap target file.
>  
> *Solution*
> Do not filter out any seq files before selecting the files. After selecting 
> the files, judge whether the seq files have been deleted or being compacted. 
> If there are any, the task will be discarded.



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

Reply via email to