[
https://issues.apache.org/jira/browse/ROCKETMQ-45?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15833261#comment-15833261
]
ASF GitHub Bot commented on ROCKETMQ-45:
----------------------------------------
Github user lizhanhui commented on a diff in the pull request:
https://github.com/apache/incubator-rocketmq/pull/39#discussion_r97212223
--- Diff:
store/src/main/java/org/apache/rocketmq/store/MappedFileQueue.java ---
@@ -397,11 +397,21 @@ public int deleteExpiredFileByOffset(long offset, int
unitSize) {
log.info("physic min offset " + offset + ", logics
in current mappedFile max offset "
+ maxOffsetInLogicQueue + ", delete it");
}
+ } else if (!mappedFile.isAvailable()) { // Handle hanged
file.
--- End diff --
> Another thing, can we just mark destroy=true in else if section and next
if will destroy it ?
Yep, I think we can do this.
> 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,
> 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.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)