[
https://issues.apache.org/jira/browse/OAK-7132?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16326029#comment-16326029
]
Michael Dürig commented on OAK-7132:
------------------------------------
The patch has a somewhat troublesome dependency on the {{gc.log}} to determine
the type of the last compaction run. This dependency can potentially introduce
subtle bugs should the {{gc.log}} be not up to date due to timing or instance
crashes. Also repository backup and cold standby would be affected as in these
cases the type of the last compaction cannot be derived from the {{gc.log}} at
all. Finally the patch does not cover that case where a segment retention time
of more than 2 is configured.
To address above issues I propose:
* To rework the patch such that it does not depend on the {{gc.log}} to figure
out the type of the last compaction run but instead transiently track that
information in the {{FileStore}} garbage collector. When that information is
not available (e.g. after a crash / restart) fall back to a safe but less
efficient cleanup.
* Ensure the gc type information is consistent and there are no data races. (I
guess we need to make {{FileStore.GarbageCollector.cleanup()}} synchronized for
this.
* Use a retention time of 1 generation for offline compaction, repository
backup and cold standby as in all these cases the last compaction type is not
available via above mechanism. (I think 1 generation is already in effect for
all but cold standby. For the latter we need to double check if this is
actually safe).
* Rethink if we really need retention times greater than 2 generations:
** If so, we need to track more information that just the type of the previous
compaction as e.g. with 3 retained generations the tail compaction followed by
a full compaction would still need to retain the tail of the previous full
compaction. This would require additional test coverage.
** If not, we need to determine how to handle the backward incompatible change
by restraining the set of possible configuration values.
> SNFE after full compaction
> --------------------------
>
> Key: OAK-7132
> URL: https://issues.apache.org/jira/browse/OAK-7132
> Project: Jackrabbit Oak
> Issue Type: Bug
> Components: segment-tar
> Affects Versions: 1.8.0
> Reporter: Michael Dürig
> Assignee: Michael Dürig
> Priority: Blocker
> Labels: compaction
> Fix For: 1.9.0, 1.10, 1.8.1
>
> Attachments: size.png
>
>
> In some cases we observed a {{SNFE}} right after a the cleanup following a
> full compaction:
> {noformat}
> 31.12.2017 04:25:19.816 *ERROR* [pool-17-thread-22]
> org.apache.jackrabbit.oak.segment.SegmentNotFoundExceptionListener Segment
> not found: a82a99a3-f1e9-49b7-a1e0-55e7fec80c41. SegmentId
> age=609487478ms,segment-generation=GCGeneration{generation=4,fullGeneration=2,isCompacted=true}
> org.apache.jackrabbit.oak.segment.SegmentNotFoundException: Segment
> a82a99a3-f1e9-49b7-a1e0-55e7fec80c41 not found
> at
> org.apache.jackrabbit.oak.segment.file.AbstractFileStore.readSegmentUncached(AbstractFileStore.java:276)
> at
> org.apache.jackrabbit.oak.segment.file.FileStore.lambda$readSegment$5(FileStore.java:478)
> at
> org.apache.jackrabbit.oak.segment.SegmentCache.lambda$getSegment$0(SegmentCache.java:116)
> at
> com.google.common.cache.LocalCache$LocalManualCache$1.load(LocalCache.java:4724)
> at
> com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3522)
> at
> com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2315)
> at
> com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2278)
> at
> com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2193)
> at com.google.common.cache.LocalCache.get(LocalCache.java:3932)
> at
> com.google.common.cache.LocalCache$LocalManualCache.get(LocalCache.java:4721)
> at
> org.apache.jackrabbit.oak.segment.SegmentCache.getSegment(SegmentCache.java:113)
> at
> org.apache.jackrabbit.oak.segment.file.FileStore.readSegment(FileStore.java:478)
> at
> org.apache.jackrabbit.oak.segment.SegmentId.getSegment(SegmentId.java:154)
> at
> org.apache.jackrabbit.oak.segment.CachingSegmentReader$1.apply(CachingSegmentReader.java:94)
> at
> org.apache.jackrabbit.oak.segment.CachingSegmentReader$1.apply(CachingSegmentReader.java:90)
> at
> org.apache.jackrabbit.oak.segment.ReaderCache.get(ReaderCache.java:118)
> at
> org.apache.jackrabbit.oak.segment.CachingSegmentReader.readString(CachingSegmentReader.java:90)
> at
> org.apache.jackrabbit.oak.segment.MapRecord.getEntry(MapRecord.java:220)
> at
> org.apache.jackrabbit.oak.segment.MapRecord.getEntry(MapRecord.java:173)
> at
> org.apache.jackrabbit.oak.segment.SegmentNodeState.getChildNode(SegmentNodeState.java:423)
> at
> org.apache.jackrabbit.oak.plugins.memory.MemoryNodeBuilder.<init>(MemoryNodeBuilder.java:143)
> at
> org.apache.jackrabbit.oak.segment.SegmentNodeBuilder.<init>(SegmentNodeBuilder.java:93)
> at
> org.apache.jackrabbit.oak.segment.SegmentNodeBuilder.createChildBuilder(SegmentNodeBuilder.java:148)
> at
> org.apache.jackrabbit.oak.plugins.memory.MemoryNodeBuilder.getChildNode(MemoryNodeBuilder.java:331)
> at
> org.apache.jackrabbit.oak.core.SecureNodeBuilder.<init>(SecureNodeBuilder.java:112)
> at
> org.apache.jackrabbit.oak.core.SecureNodeBuilder.getChildNode(SecureNodeBuilder.java:329)
> at
> org.apache.jackrabbit.oak.core.MutableTree.getTree(MutableTree.java:290)
> at
> org.apache.jackrabbit.oak.core.MutableRoot.getTree(MutableRoot.java:220)
> at
> org.apache.jackrabbit.oak.core.MutableRoot.getTree(MutableRoot.java:69)
> at
> org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.getItem(SessionDelegate.java:442)
> at
> org.apache.jackrabbit.oak.jcr.session.SessionImpl.getItemInternal(SessionImpl.java:167)
> at
> org.apache.jackrabbit.oak.jcr.session.SessionImpl.access$400(SessionImpl.java:82)
> at
> org.apache.jackrabbit.oak.jcr.session.SessionImpl$3.performNullable(SessionImpl.java:229)
> at
> org.apache.jackrabbit.oak.jcr.session.SessionImpl$3.performNullable(SessionImpl.java:226)
> at
> org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.performNullable(SessionDelegate.java:243)
> at
> org.apache.jackrabbit.oak.jcr.session.SessionImpl.getItemOrNull(SessionImpl.java:226)
> {noformat}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)