You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@rocketmq.apache.org by "Zhanhui Li (JIRA)" <ji...@apache.org> on 2017/01/12 07:26:52 UTC

[jira] [Updated] (ROCKETMQ-45) Delete consume queue hang file

     [ https://issues.apache.org/jira/browse/ROCKETMQ-45?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Zhanhui Li updated ROCKETMQ-45:
-------------------------------
    Description: 
Consume queue file may hang and stop further deleting under concurrent scenario.

If the consume queue file is concurrently held by another thread, mappedFile.destroy(interval) will only set firstShutdownTimestamp to current timestamp and available false, then  return false directly. 
Check MappedFileQueue.java#deleteExpiredFileByOffset, 
[code]
if (destroy && mappedFile.destroy(1000 * 60)) {
                    files.add(mappedFile);
                    deleteCount++;
                } else {
                    break;
                }
[/code]
the current round of deletion will be stopped and current mapped file becomes handed.

Next time trying to delete mapped file of this mapped file queue,  MappedFileQueue.java#deleteExpiredFileByOffset(offset, unitSize) line No.390
MappedFile mappedFile = (MappedFile) mfs[i];
                SelectMappedBufferResult result = mappedFile.selectMappedBuffer(this.mappedFileSize - unitSize);
will always return null as the mapped file is no longer available and cannot hold. Current implementation will only log a warn and exit.

  was:
Consume queue file may hang and stop further deleting under concurrent scenario.

If the consume queue file is concurrently held by another thread, mappedFile.destroy(interval) will only set firstShutdownTimestamp to current timestamp and available false, then  return false directly. 
Check MappedFileQueue.java#deleteExpiredFileByOffset, 
if (destroy && mappedFile.destroy(1000 * 60)) {
                    files.add(mappedFile);
                    deleteCount++;
                } else {
                    break;
                }
the current round of deletion will be stopped and current mapped file becomes handed.

Next time trying to delete mapped file of this mapped file queue,  MappedFileQueue.java#deleteExpiredFileByOffset(offset, unitSize) line No.390
MappedFile mappedFile = (MappedFile) mfs[i];
                SelectMappedBufferResult result = mappedFile.selectMappedBuffer(this.mappedFileSize - unitSize);
will always return null as the mapped file is no longer available and cannot hold. Current implementation will only log a warn and exit.


> Delete consume queue hang file
> ------------------------------
>
>                 Key: ROCKETMQ-45
>                 URL: https://issues.apache.org/jira/browse/ROCKETMQ-45
>             Project: Apache RocketMQ
>          Issue Type: Bug
>          Components: rocketmq-store
>    Affects Versions: 4.1.0-incubating
>            Reporter: Zhanhui Li
>            Assignee: yukon
>             Fix For: 4.1.0-incubating
>
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> Consume queue file may hang and stop further deleting under concurrent scenario.
> If the consume queue file is concurrently held by another thread, mappedFile.destroy(interval) will only set firstShutdownTimestamp to current timestamp and available false, then  return false directly. 
> Check MappedFileQueue.java#deleteExpiredFileByOffset, 
> [code]
> if (destroy && mappedFile.destroy(1000 * 60)) {
>                     files.add(mappedFile);
>                     deleteCount++;
>                 } else {
>                     break;
>                 }
> [/code]
> the current round of deletion will be stopped and current mapped file becomes handed.
> Next time trying to delete mapped file of this mapped file queue,  MappedFileQueue.java#deleteExpiredFileByOffset(offset, unitSize) line No.390
> MappedFile mappedFile = (MappedFile) mfs[i];
>                 SelectMappedBufferResult result = mappedFile.selectMappedBuffer(this.mappedFileSize - unitSize);
> will always return null as the mapped file is no longer available and cannot hold. Current implementation will only log a warn and exit.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)